• 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
Applescript (using do javascript) to log in to a password protected webpage is failing on the button-click step
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Applescript (using do javascript) to log in to a password protected webpage is failing on the button-click step


  • Subject: 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 13:48:59 -0500

I am a beginning-to-intermediate AppleScripter.  My AppleScript designed to log on to a password-protected website successfully fills the username and password fields of a website but is not successfully clicking the “sign in” button, which, on this particular website, occurs within a <button> element of type=submit, and is not within a <form> element.  The script returns “missing value”.

I have included fake username and password.  The real values work when I log in manually.

Have I given enough information for you to troubleshoot?  Any thoughts?  

Thanks.

William

P.S.  Sorry if my pasted quotes turn into curly quotes.


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




 _______________________________________________
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: Applescript (using do javascript) to log in to a password protected webpage is failing on the button-click step
      • From: Deivy Petrescu <email@hidden>
  • Prev by Date: Re: Script to Open Camera RAW File Doesn't Open File, Gives No Error
  • Next by Date: Re: Applescript (using do javascript) to log in to a password protected webpage is failing on the button-click step
  • Previous by thread: Re: Script to Open Camera RAW File Doesn't Open File, Gives No Error
  • Next by thread: Re: Applescript (using do javascript) to log in to a password protected webpage is failing on the button-click step
  • Index(es):
    • Date
    • Thread