gpt4 book ai didi

javascript - Applescript : wait that the page is load on chrome

转载 作者:行者123 更新时间:2023-12-03 04:59:17 24 4
gpt4 key购买 nike

tell application "Safari"
repeat until (do JavaScript "document.readyState" in tab 2 of window 1) is "complete"
end repeat
end tell
end if

如何在 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 ),并且它可以使用它,但对于大多数页面(我已经尝试过 yahoo、macupdate、bbc news、jedit.org 等)我不是永远得到“loading = true”。可能有问题。

关于javascript - Applescript : wait that the page is load on chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42292181/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com