Re: Applescript (using do javascript) to log in to a password protected webpage is failing on the button-click step
Re: Applescript (using do javascript) to log in to a password protected webpage is failing on the button-click step
- Subject: Re: Applescript (using do javascript) to log in to a password protected webpage is failing on the button-click step
- From: William Dockery <email@hidden>
- Date: Mon, 23 May 2016 14:26:08 -0500
And that’s my kind of answer! Thanks so much--
On May 23, 2016, at 2:11 PM, Deivy Petrescu < email@hidden> wrote:
William, this is my kind of error: document.getElementById not document.getElementByID (check the last “d”)On May 23, 2016, at 14:48 , William Dockery <email@hidden> wrote:
set ASURL to "https://campsself.active.com/MiddleburyInteractiveLanguages" set ASusername to "a" set ASpassword to "b"
tell application "Safari" open location ASURL end tell
delay 5
inputByID("apl-username", ASusername) inputByID("apl-password", ASpassword)
delay 3
clickthebutton("apl-btn-login")
to inputByID(theId, theValue) tell application "Safari" do _javascript_ " document.getElementById('" & theId & "').value ='" & theValue & "';" in document 1 end tell -- stops using safari end inputByID --marks the end of the function to clickthebutton(theId) tell application "Safari" do _javascript_ " document.getElementByID('" & theId & "').click();" in document 1 end tell end clickthebutton
Script events:
tell application "Safari" open location "https://campsself.active.com/MiddleburyInteractiveLanguages" do _javascript_ " document.getElementById('apl-username').value ='a';" in document 1 do _javascript_ " document.getElementById('apl-password').value ='b';" in document 1 do _javascript_ " document.getElementByID('apl-btn-login').click();" in document 1 end tell
Deivy Petrescuemail@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