0
tell application "Safari"
repeat until (do JavaScript "document.readyState" in tab 2 of window 1) is "complete"
end repeat
end tell
end if
我该如何使用Chrome进行操作?AppleScript:等待页面加载到Chrome上
tell application "Safari"
repeat until (do JavaScript "document.readyState" in tab 2 of window 1) is "complete"
end repeat
end tell
end if
我该如何使用Chrome进行操作?AppleScript:等待页面加载到Chrome上
你应该能够做到
tell application "Google Chrome"
repeat until (execute tab 1 of window 1 javascript "document.readyState" is "complete")
end repeat
execute tab 1 of window 1 javascript "document.readyState"
end tell
,不过你可以返回“互动”永远的,或者很长一段时间的页面。
只有AppleScript的做,就应该是:
tell application "Google Chrome"
repeat until (loading of tab 1 of window 1 is false)
1 + 1 --just an arbitary line
end repeat
loading of tab 1 of window 1 --this just returns final status
end tell
但是,告诉你实话,我觉得很可疑。我有一个非常光秃的HTML页面(http://www.crgreen.com/boethos/boethos.html),它适用于大多数页面(我试过雅虎,macupdate,bbc新闻,jedit.org等)。我没有收到“loading = true”,永远。它可能是越野车。
谢谢!我会在几分钟内尝试所有这一切,这很好。 –