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: Bill Cheeseman <email@hidden>
- Date: Tue, 13 Apr 2010 08:39:42 -0400
On Apr 13, 2010, at 6:54 AM, Victor 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
GUI Scripting's 'keystroke' command is always sent directly to the target application. If the keystroke is not a keyboard shortcut, the target application then sends it to whatever UI element in the target application currently has keyboard focus. To make your script work, you must therefore set focus to the password field before entering the password. I tested this revised version of your script, and it worked:
set codice to "123456" set passw to "654321"
tell application "Safari" activate open location paginaweb delay 2 --finishLoad end tell tell application "System Events" tell process "Safari" tell 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" set focused of text field 1 to true keystroke (codice)
set focused of text field 2 to true keystroke (passw) end tell end tell end tell
|
_______________________________________________
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