可以AppleScript的访问浏览器标签,并在其中执行JavaScript的? [英] Can AppleScript access browser tabs and execute javascript in them?
本文介绍了可以AppleScript的访问浏览器标签,并在其中执行JavaScript的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很好奇,如果AppleScript的可以在浏览器访问每个特定的标签,并在其中执行一些JavaScript。
I'm curious if AppleScript can access each specific tab in a browser and execute some javascript in them.
任何人有想法?
推荐答案
对于谷歌Chrome浏览器后,使用执行
从AppleScript的铬套件:
For Google Chrome, use execute
from AppleScript Chromium Suite:
执行五:执行一段JavaScript。
execute v : Execute a piece of javascript.
执行 说明的:该选项卡中执行命令
execute specifier : The tab to execute the command in.
的JavaScript 文本的:JavaScript的code执行
javascript text : The javascript code to execute.
例如:
tell application "Google Chrome"
execute front window's active tab javascript "alert('example');"
end tell
中可以做的 Safari浏览器或者
tell application "Safari" to do JavaScript "alert('example')" in document 1
有关其他的浏览器,选中的功能的文件 - >打开字典
上的AppleScript编辑器。
For other browsers, check the functions at File -> Open Dictionary
on AppleScript editor.
这篇关于可以AppleScript的访问浏览器标签,并在其中执行JavaScript的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文