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」,永遠。它可能是越野車。
謝謝!我會在幾分鐘內嘗試所有這一切,這很好。 –