如何单击每个 window 的所有选项卡中的特定按钮
How to click a specific button in all tab of every window
我在 5 个不同的 windows 中打开一个网页,并希望在每个 window 的所有选项卡中单击相同的按钮
我写了这个脚本,它只对一个 window 有效,但在剩下的 4 windows
中没有任何反应
tell application "Safari"
repeat with t in tabs of windows
do JavaScript "document.getElementsByClassName('submitButton')[7].click();" in document 1
end repeat
end tell
只需将 document 1
替换为 t
tell application "Safari"
repeat with t in tabs of windows
do JavaScript "document.getElementsByClassName('submitButton')[7].click();" in t
end repeat
end tell
我在 5 个不同的 windows 中打开一个网页,并希望在每个 window 的所有选项卡中单击相同的按钮 我写了这个脚本,它只对一个 window 有效,但在剩下的 4 windows
中没有任何反应tell application "Safari"
repeat with t in tabs of windows
do JavaScript "document.getElementsByClassName('submitButton')[7].click();" in document 1
end repeat
end tell
只需将 document 1
替换为 t
tell application "Safari"
repeat with t in tabs of windows
do JavaScript "document.getElementsByClassName('submitButton')[7].click();" in t
end repeat
end tell