2016-03-19 19 views
0

Ich möchte meine epaper mit AppleScript und Safari herunterladen. Hier ist mein Code:getElementById in 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 

Es lädt die Seite, Safari automatisch in die Anmeldedaten füllt, aber dann hört es auf mit „Wert fehlt“ „document.getElementById (‚submit_btn‘) klicken().“.

Was habe ich falsch gemacht?

Antwort

0

Sie müssen zu den childNodes des Elements gehen, damit dies funktioniert.

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