• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: GUI scripting: Beginner unable to fill a field text of a web page
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: "Mark J. Reed" <email@hidden>
  • Date: Tue, 13 Apr 2010 08:53:12 -0400

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:

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      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: GUI scripting: Beginner unable to fill a field text of a web page
      • From: Emmanuel LEVY <email@hidden>
References: 
 >GUI scripting: Beginner unable to fill a field text of a web page (From: Victor <email@hidden>)

  • Prev by Date: Re: GUI scripting: Beginner unable to fill a field text of a web page
  • Next by Date: 10.6 and Keychain...
  • Previous by thread: Re: GUI scripting: Beginner unable to fill a field text of a web page
  • Next by thread: Re: GUI scripting: Beginner unable to fill a field text of a web page
  • Index(es):
    • Date
    • Thread