Ich muss ein Textfeld ausfüllen und auf eine Schaltfläche in Google Chrome klicken
Hier ist mein Skript für Safari.
tell application "Safari"
## tell window 1 of application "Safari" to set current tab to tab 1
-- Last Name
do JavaScript "document.getElementsByName('0.7.7.7.7.7.5')[0].value=" & quoted form of theProfil & "" in tab 1 of window 1
-- search
delay 0.1
do JavaScript "document.getElementsByName('0.7.7.7.7.1.7')[0].click();" in tab 1 of window 1
Wie kann ich dies (getElementsByName) mit Chrome verwenden?
Beifall.
Google Chrome ist über die Chromium-Suite skriptfähig – die execute
Methode ist genau das, wonach Sie suchen. Hier ist ein Beispiel Ihres Codes, neu geschrieben für Chrome:
tell application "Google Chrome"
execute front window's active tab javascript "document.getElementsByName('0.7.7.7.7.7.5')[0].value=" & quoted form of theProfil & ""
delay 0.1
execute front window's active tab javascript "document.getElementsByName('0.7.7.7.7.1.7')[0].click();"
end tell
Sehen Sie sich diese Frage zu Stack Overflow als Referenz an oder konsultieren Sie das Google Chrome AppleScript-Wörterbuch (klicken Sie im Skripteditor auf File
> Open Dictionary…
und wählen Sie Google Chrome).
Allan