Re: GUI scripting: Beginner unable to fill a field text of a web page
Re: GUI scripting: Beginner unable to fill a field text of a web page
- Subject: Re: GUI scripting: Beginner unable to fill a field text of a web page
- From: Emmanuel LEVY <email@hidden>
- Date: Tue, 13 Apr 2010 17:42:16 +0200
On Apr 13, 2010, at 2:53 PM, Mark J. Reed wrote:
GUI scripting Safari seems unnecessary. There may be times when it's
needed, as when you're interacting with a Flash or Java applet, but
with a simple HTML form, do JavaScript is probably both simpler and
more reliable. In general, you can use either the "view source" menu
command or the Safari developer tools, specifically the element view,
to find the ID of the fields, but I already did that for your form, so
the snippet below should work as-is:
I second Mark for the strategy, for the details I think you have to
target a window, something like: do Javascript "blah" in document 1
tell application "Safari"
do JavaScript "document.getElementById('username').value = " &
quoted form of codice
do JavaScript "document.getElementById('autentication').value = "
& quoted form of passw
end tell
(That's not a typo on my part; the password field's ID seems to be an
amalgam of Italian and English spelling.)
On Tuesday, April 13, 2010, Victor <email@hidden> wrote:
I'm an absolute beginner with Applescript.After the complete and
attentive reading of "Applescript 1-2-3" and after installing UI
Browser only last night, I'm now having a go at GUI Scripting
inputing a userid (CODICE) and password (PIN) to login into my bank
site (see the unrefined code below).
Now, while this code reaches text field 1 easily and fill it with
the string "codice", it cannot repeat the same with field text 2 to
write the string passw. As a matter of fact UI Browser screen
reader while tells me the exact number of text field 1 (CODICE)
says that there is some MISMATCH in the second field (PIN) .
Please help Vittorio
get system attribute "sysv"
set paginaweb to "https://online.bancaroma.it/login.htm"set codice
to "123456"set passw to "654321"
tell application "Safari" activate open location paginaweb delay
2 --finishLoadend telltell application "System Events" tell process
"Safari" tell text field 1 of group 1 of UI element 1 of scroll
area 1 of group 9 of UI element 1 of scroll area 1 of group 3 of
window "Banca via Internet - UniCredit Banca di Roma" keystroke
(codice) delay 1
end tell
tell text field 2 of group 1 of UI element 1 of scroll area 1 of
group 9 of UI element 1 of scroll area 1 of group 3 of window
"Banca via Internet - UniCredit Banca di Roma" keystroke
(passw) end tell
end tellend tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden