我想用AppleScript和Safari下载我的电子书。这是我的代码:
tell application "Safari"
activate
make new document with properties {URL:"https://kundenkonto.mittelbayerische.de/frontend/login.php?service=http://epaper.mittelbayerische.de/edition-mbz/index2.jsp%3Flang%3Dde"}
delay 5
tell document 1
do JavaScript "document.getElementById('submit_btn').click()"
delay 5
do JavaScript "loadEditionPDF();"
end tell
end tell
它加载网站,Safari自动填写登录凭据,但随后它停在“document.getElementById('submit_btn')。click()”with“缺少值”。
我做错了什么?
答案 0 :(得分:0)
你需要转到元素的childNodes,这样才能正常工作。
tell application "Safari"
activate
make new document with properties {URL:"https://kundenkonto.mittelbayerische.de/frontend/login.php?service=http://epaper.mittelbayerische.de/edition-mbz/index2.jsp%3Flang%3Dde"}
delay 5
tell document 1
do JavaScript "document.getElementById('submit_btn').childNodes[0].click()"
delay 5
do JavaScript "loadEditionPDF();"
end tell
end tell