[英]Unable to run javascript function with AppleScript
I'm trying control video functions of a website by using applescript. 我正在尝试使用applescript控制网站的视频功能。 The website has a flash video - jwplayer.
该网站有一个Flash视频-jwplayer。 In Google Chrome, I'm able to pause the video if I type in the command
在Google Chrome浏览器中,如果我键入以下命令,则可以暂停视频
jwplayer('player_embed').pause();
However, if I send in the command through AppleScript, it fails to work. 但是,如果我通过AppleScript发送命令,它将无法正常工作。
The console error message I get is as follows 我收到的控制台错误消息如下
And clicking VM4054:2 gives me this 然后单击VM4054:2就可以了
Is it an option to use Safari? 可以使用Safari吗? This works...
这有效...
tell application "Safari"
repeat with t in tabs of windows
tell t
if URL starts with "https://www.jwp" then
do JavaScript "jwplayer().pause();"
end if
end tell
end repeat
end tell
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.