mknope Posted October 22, 2018 Share Posted October 22, 2018 Hello, I am working on a script for inputting my username/password to a website that I frequent throughout the day for work. I know login scripts are a touchy subject but my computer is locked down to my access only and I plan on logging into the script with my credentials each day (stored in INI) and press a hot key to insert my username/password when I need to log in. I posted the code I am working with below. I have used this code before and it worked well but I am having an issue with focusing on username, password, and login button from the following link: https://advnmd.cernerworks.com/Citrix/ProdWeb/ Any help or direction would be appreciated. $oInputs = _IETagNameGetCollection($oIE, "input") for $oInput in $oInputs if $oInput.type = "text" And $oInput.name = "username" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "password" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.value = "Log In" Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next $oUser.value = $sUser $oPass.value = $sPass _IEAction($oSubmit, "click") _IELoadWait($oIE) WEnd Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 22, 2018 Moderators Share Posted October 22, 2018 (edited) 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 AutoIt General Help and Support Moderation Team Edited October 22, 2018 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 More sharing options...
Danp2 Posted October 22, 2018 Share Posted October 22, 2018 Are you experiencing any errors? Run the code in Scite and show us the results from the Output panel. Also, have you considered using _IEGetObjById or _IEGetObjByName to retrieve the desired elements without looping through them all. Looking at this website, I suspect your issue is that you aren't finding the Log In button, since it's a link and not an input element. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mknope Posted October 22, 2018 Author Share Posted October 22, 2018 Here is the error I am seeing: --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop --> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch "C:\Users\michael.knope\Documents\AutoIT\CernerWorks Login\CWX CERT Link.au3" (41) : ==> Variable must be of type "Object".: $oUser.value = $sUser $oUser^ ERROR ->12:50:53 AutoIt3.exe ended.rc:1 +>12:50:53 AutoIt3Wrapper Finished. >Exit code: 1 Time: 2.852 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 22, 2018 Moderators Share Posted October 22, 2018 @mknope The error is telling you that $oUser.value does not exist. In general, you should have some error checking in place to ensure $oUser returns what you expect it to. "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 More sharing options...
Danp2 Posted October 22, 2018 Share Posted October 22, 2018 This works for me. Note that YMMV on the Sleep statement, but I found it was needed to get the website time to load completely. #include <ie.au3> Local $oIE = _IECreate("https://advnmd.cernerworks.com/Citrix/ProdWeb/") Sleep(2000) Local $oUser = _IEGetObjById($oIE, "username") Local $oPass = _IEGetObjById($oIE, "password") $oUser.value = 'test' $oPass.value = 'pass' _IELinkClickByText($oIE, 'Log On') Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mknope Posted October 22, 2018 Author Share Posted October 22, 2018 @Danp2 That worked perfectly! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now