我在5个不同的窗口中打开一个网页,并希望在每个窗口的所有选项卡中单击相同的按钮 我写这个脚本,它只在一个窗口工作,但剩下的4个窗口都没有发生
tell application "Safari"
repeat with t in tabs of windows
do JavaScript "document.getElementsByClassName('submitButton')[7].click();" in document 1
end repeat
end tell
答案 0 :(得分:0)
只需将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