Jump to content

Automating SimplySafe issues with login


 Share

Recommended Posts

I had in the past a script that I could use to automate the arming and disarming of a SImplysafe system via their website. The other day they updated the website and I can not figure out how to get the site to recognize that I entered in a user name and password. Seems they have changed the website to where the script below can no longer insert the user name and password where the site sees it. The script does insert the two values but the website does seem to know this. In looking at the code it appears that you now must click into the field and enter the text. Then they have javascript that changes a input class tag, changing some variables to things like "not empty" and "ng email", etc. I can't seem to figure out how to get the site to see that I entered in a value in each field.

Before you enter in user name / password - 

<input class="password ng-valid ng-dirty ng-valid-parse ng-touched ng-empty" type="password" name="password" placeholder="password" ng-model="login.password" ng-keyup="$event.keyCode === 13 ? login.login() : null" aria-invalid="false" style="">

After you enter in user name / password - 

<input class="password ng-valid ng-not-empty ng-dirty ng-valid-parse ng-touched" type="password" name="password" placeholder="password" ng-model="login.password" ng-keyup="$event.keyCode === 13 ? login.login() : null" aria-invalid="false" style="">

The class="password ng-valid ng-dirty ng-valid-parse ng-touched ng-empty" doesn't seem to update by setting the field thru the script.

Website - https://webapp.simplisafe.com/#/login (for testing you can create a dummy account by just registering - you don't have to have an actual account)

Below is the original script - 

#include <IE.au3>

#Include <IE.au3>

Call ("SignIn")
Sleep(8000)
Call ("SetToHome")
Sleep(40000)
Call ("Signout")
Sleep (3000)
Call ("Terminate")

Func SignIn()
   Global $oIE = _IECreate("https://webapp.simplisafe.com/#/login")
   Global $username = _IEGetObjByName ($oIE, "email")
   Global $password = _IEGetObjByName ($oIE, "password")
       _IEFormElementSetValue ($username, "your user name")
    _IEFormElementSetValue ($password, "your password")
   clickobjbyclass($oIE, 'ss-standard-button')
EndFunc

Func clickobjbyclass(ByRef $oIE, $class)
    $tags = $oIE.document.GetElementsByTagName('button')
    For $tag In $tags
        $class = $tag.GetAttribute('class')
        If String($class) = $class Then
            Return _IEAction($tag, 'click')
        EndIf
    Next
    Return False
EndFunc

Func SetToHome()
    Local $home = _IEGetObjById ($oIE, "home-circle")
    _IEAction ($home, "click")
 EndFunc

Func SignOut()
       _IENavigate ($oIE, "https://webapp.simplisafe.com/logout")
EndFunc

Func Terminate()
    _IEQuit($oIE)
    Exit
EndFunc

 

Any help is greatly appreciated.

Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum.

Moderation Team

Edit: Come on! Three Posts in 30 minutes, in three different spots? Really?

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I was able to finally able to figure this out. 

#Include <IE.au3>

Call ("SignIn")
Sleep (10000);<= delay 10 seconds
Call ("SetToHome")
Sleep(30000);<= delay 30 seconds
Call ("Signout")
Sleep (10000);<= delay 10 seconds
Call ("Terminate")

Func SignIn()
   Global $oIE = _IECreate("https://webapp.simplisafe.com/#/login")
   Local $hIE

   While Not IsHWnd($hIE)
      $hIE = _IEPropertyGet($oIE, "hwnd")
   WEnd

   While Not WinActive($hIE)
      WinActivate($hIE)
   WEnd

   Sleep (3000);<= delay to allow IE to load SS site
   Send("{TAB 6}");<= tab to email ddress field
   Sleep (3000);<= delay to allow IE to load SS site
   Send("YOUR EMAIL ADDRESS");<= enter email address
   Send("{TAB}");<= tab to password field
   Sleep (3000);<= delay to allow IE to load SS site
   Send("YOUR PASSWORD");<= enter in password
   Sleep (3000);<= delay to allow IE to load SS site

   clickobjbyclass($oIE, 'ss-standard-button');<= find login button
EndFunc

Func clickobjbyclass(ByRef $oIE, $class)
    $tags = $oIE.document.GetElementsByTagName('button');<= get all button classes on page
    For $tag In $tags
        $class = $tag.GetAttribute('class')
        If String($class) = $class Then ;<= looking for ss-standard-button class of the login button
            Return _IEAction($tag, 'click');<= press login button
        EndIf
    Next
    Return False;<= error out in case the login button is not located
EndFunc

Func SetToHome()
    Local $home = _IEGetObjById ($oIE, "home-circle");<= locate the home-circle class
    _IEAction ($home, "click");<= press Home
 EndFunc

Func SignOut()
       _IENavigate ($oIE, "https://webapp.simplisafe.com/#/logout");<= logout of account
EndFunc

Func Terminate()
    _IEQuit($oIE);<= exit IE
    Exit
EndFunc

Edited by dchriest
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...