azurekite Posted December 19, 2012 Share Posted December 19, 2012 (edited) Hello, First off, hello (again?)! I've known about AutoIt for some time now but I've finally found a really good reason to get involved with it. I'm currently working on a script that automatically launches a page, enters the credentials, and clicks the sign in button. I've gotten the script to work with focusing the fields and using Send() but I found that it didn't work 100% of the time and since I'm generating this for users in order to alleviate issues I'd really like to avoid that. I have gotten it to set the variables correctly and it lists them correctly in my MsgBox but no matter what I do the click seems to fail. I'm not sure if it's the way the watermark is working or some javascript behind the scenes. Any help would be much appreciated. #include <IE.au3> _IEErrorHandlerRegister() $oIE = _IECreate("https://www.employflorida.com/vosnet/Default.aspx", 1, 1, 1, 1) _IELoadWait($oIE) $oForm = _IEFormGetObjByName($oIE, "aspnetForm") $u_oObject = _IEFormElementGetObjByName($oForm, "ctl00$txtUsername") _IEFormElementSetValue($u_oObject, "username") $p_oObject = _IEFormElementGetObjByName($oForm, "ctl00$txtPassword") _IEFormElementSetValue($p_oObject, "password") MsgBox(0, "", "Username: " & _IEFormElementGetValue($u_oObject) & @CRLF & "Password: " & _IEFormElementGetValue($p_oObject)) $go_submit = _IEGetObjByID($oIE, "ctl00_cmdLogin") _IEAction($go_submit, "click") Edited December 19, 2012 by azurekite Link to comment Share on other sites More sharing options...
JohnOne Posted December 19, 2012 Share Posted December 19, 2012 Looks like $go_submit = _IEGetObjByID($oIE, "ctl00_cmdLogin") should be $go_submit = _IEGetObjByID($oForm, "ctl00_cmdLogin") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
azurekite Posted December 19, 2012 Author Share Posted December 19, 2012 Hmm, it seems like that would have been important but it still won't submit. It seems like some javascript is preventing it because it doesn't actually enter information into the field. Is there an alternative way to physically enter things into the field that could be used without _IEAction("", "focus") and Send()? Link to comment Share on other sites More sharing options...
ileandros Posted December 19, 2012 Share Posted December 19, 2012 (edited) Edit: _IEFormElementSetValue() I couldnt load the page to test it Edited December 19, 2012 by ileandros I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
azurekite Posted December 19, 2012 Author Share Posted December 19, 2012 Digging into it a little more, I'm sure now that my problems are stemming from this chunk of code. function conditionScript() { if ($('#txtUsername').val() == '' || $('#txtUsername').val() == 'Username' || $('#txtPassword').val() == 'Password') { return false; } else { return true; } It's reading the text as not being changed while it actually has been changed via AutoIt. Any suggestions on circumventing this? Link to comment Share on other sites More sharing options...
water Posted December 19, 2012 Share Posted December 19, 2012 azurekite,Welcome to AutoIt and the forum!Please make sure to read the forum rules.Not allowed here is: "Bypassing of security measures - log-in and security dialogs"So you won't get much help on this subject here. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
bogQ Posted December 19, 2012 Share Posted December 19, 2012 (edited) i was just about to post questi on did forum rules changed, hguess water is faster Edited December 19, 2012 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
water Posted December 19, 2012 Share Posted December 19, 2012 bogQ, Forum rules did change (on 2012-11-07) but automating logins is still not permitted. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted December 19, 2012 Share Posted December 19, 2012 Hmm Smoke said it was allowed yesterday. Anyway, the code worked fine for me on that link with $go_submit = _IEGetObjByID($oForm, "ctl00_cmdLogin") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 19, 2012 Moderators Share Posted December 19, 2012 Hi all,Please read those Forum Rules carefully - I did mention when I posted them that there were some subtle changes. As quoted by water above, we do not permit discussion of "Bypassing of security measures - log-in and security dialogs". However, this is a simple web page and so automation in this case is permitted. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
azurekite Posted December 19, 2012 Author Share Posted December 19, 2012 Yay, thank you Melba. I work for a company that uses this website and has certain levels of access to it including some backend systems and I'm trying to automate what we call the Scan Card Kiosk stations that way it'll automatically set itself up in the morning for the staff members who're coming in so they don't have to do it themselves. We rely on touchscreen systems for these kiosks and the touchscreen keyboard can get tiresome with this website. Link to comment Share on other sites More sharing options...
water Posted December 19, 2012 Share Posted December 19, 2012 I always have read it as: A login is a login is a login. I'm sure there is a reason for this subtle change - and I'm sure I missed it. Can anyone lend me a hand? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted December 19, 2012 Share Posted December 19, 2012 So you got it working? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 19, 2012 Moderators Share Posted December 19, 2012 (edited) water,I'm sure there is a reason for this subtle change - and I'm sure I missed it. Can anyone lend me a hand?Just accept the fact that the rule was changed and we believed we had good reasons for doing so - trust me, you really do NOT want to know the details of how we got there. M23 Edited December 19, 2012 by Melba23 Typo Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
azurekite Posted December 19, 2012 Author Share Posted December 19, 2012 Unfortunately not yet John. I'm attempting to go a different route on a second login page here: https://www.employflorida.com/loginintro.asp?logoff=true It seems that this page uses iFrames though so I get to go play with the frame collection codes now. Even after changing oIE to oForm I still couldn't get the script to submit successfully. The javascript I posted earlier still seems to think something is equal to a default value and fails out. (By the way it seems I can't make a post again until midnight, just an FYI. Don't want you thinking I'm not responding. I really appreciate all the input. :3) Link to comment Share on other sites More sharing options...
water Posted December 19, 2012 Share Posted December 19, 2012 Just accept the fact that the rule was changed and we believed we had good reasons for doing so - trust me, you really do NOT want to know the details of how we got there. Accepting the wisdom of those who set up the rules is no problem To remember the subtle differences when the next user asks the same question might be one - if it's still possible to post on Sunday My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted December 19, 2012 Share Posted December 19, 2012 (edited) Try this. #include <IE.au3> _IEErrorHandlerRegister() $oIE = _IECreate("https://www.employflorida.com/vosnet/Default.aspx", 1, 1, 1, 1) _IELoadWait($oIE) $oForm = _IEFormGetObjByName($oIE, "aspnetForm") $u_oObject = _IEFormElementGetObjByName($oForm, "ctl00$txtUsername") _IEAction($u_oObject,"focus") _IEFormElementSetValue($u_oObject, "blah") $p_oObject = _IEFormElementGetObjByName($oForm, "ctl00$txtPassword2") _IEAction($p_oObject,"focus") _IEFormElementSetValue($p_oObject, "blah") $go_submit = _IEGetObjByName($oForm, "ctl00$cmdLogin") _IEAction($go_submit, "click") ;_IEFormSubmit($oForm) Edited December 19, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
bogQ Posted December 19, 2012 Share Posted December 19, 2012 (edited) page that have some level of protection it self from inputting on password, even if it's dumb and small as its on that site, and where autocomplete="off" is of for username, shud be considered as brakeing forum rules. But it's stil dumb protection and i'll agree with Mod decision, and try to help so to JohnOne, username you got correct for password that will probably work but im not 100% shure, little trick goes like this $p_oObject = _IEFormElementGetObjByName($oForm, "ctl00$txtPassword") $p_oObject2 = _IEFormElementGetObjByName($oForm, "ctl00$txtPassword2") _IEAction($p_oObject2, "focus") _IEFormElementSetValue($p_oObject, "password11") (java focusing field on 1 of them in hope to protect one another...) Edited December 19, 2012 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
azurekite Posted December 20, 2012 Author Share Posted December 20, 2012 Hello again everyone, I finally am able to post again (yay!) so I thought I'd post that my issue is now resolved. Thanks to everyone that posted here as it's thanks to you all that I was able to get this bad boy working. expandcollapse popup#include _IEErrorHandlerRegister() ;EFM Username and Password $efm_user = "username" $efm_pass = "password" ;Kill all IE processes, if any $exist_IE = ProcessExists ("iexplore.exe") If $exist_IE Then ProcessClose($exist_IE) EndIf ;Open an new IE window leading to EFM and wait for it 500ms before checking if it is loaded $oIE = _IECreate("https://www.employflorida.com/vosnet/Default.aspx", 1, 1, 1, 1) _IELoadWait($oIE, 500) ;Load master form from main page $oForm = _IEFormGetObjByName($oIE, "aspnetForm") ;Get username field and enter username $u_oObject = _IEFormElementGetObjByName($oForm, "ctl00$txtUsername") _IEAction($u_oObject,"focus") _IEFormElementSetValue($u_oObject, $efm_user) ;Get password field and enter password $p_oObject = _IEFormElementGetObjByName($oForm, "ctl00$txtPassword") $p_oObject2 = _IEFormElementGetObjByName($oForm, "ctl00$txtPassword2") _IEAction($p_oObject2,"focus") _IEFormElementSetValue($p_oObject, $efm_pass) ;Get submit button, emulate a click, and wait for the page to load $go_submit = _IEGetObjByName($oForm, "ctl00$cmdLogin") _IEAction($go_submit, "click") _IELoadWait($oIE, 500) ;Navigate to the scan card system and wait for the new page to load _IENavigate($oIE, "https://www.employflorida.com/vosnet/staff/scankiosk.aspx") _IELoadWait($oIE, 500) ;Put the window into fullscreen mode _IEPropertySet($oIE, "theatermode", True) This is now working wonderfully and I'm going to be continuing to use this and work on improving it. My next step is for the page that it navigates to. There are certain errors that occur when a user does something incorrectly. The interface is not very intuitive so these errors come up alot. Once again, thanks everyone. Link to comment Share on other sites More sharing options...
JohnOne Posted December 20, 2012 Share Posted December 20, 2012 page that have some level of protection it self from inputting on password, even if it's dumb and small as its on that site, and where autocomplete="off" is of for username, shud be considered as brakeing forum rules. But it's stil dumb protection and i'll agree with Mod decision, and try to help so to JohnOne, username you got correct for password that will probably work but im not 100% shure, little trick goes like this $p_oObject = _IEFormElementGetObjByName($oForm, "ctl00$txtPassword") $p_oObject2 = _IEFormElementGetObjByName($oForm, "ctl00$txtPassword2") _IEAction($p_oObject2, "focus") _IEFormElementSetValue($p_oObject, "password11") (java focusing field on 1 of them in hope to protect one another...) Was just farting about with them, I believe the OP's problem was to get the form to submit so was just really focusing on the endgame. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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