Flum Posted May 2, 2020 Share Posted May 2, 2020 Good morning dear fellow scripters, WIth help of the forum search function and the autoit help file i came up with the following code: #include <IE.au3> Opt("WinTitleMatchMode", 0) $oIE = _IECreate ("https://www.klikvoorwonen.nl/mijn-klik-voor-wonen/inloggen/") ;~ Sleep(2000) $o_form = _IEFrameGetObjByName ($oIE, "loginForm") $o_login = _IEFormElementGetObjByName ($o_form, "username") ;~ $o_login = _IEGetObjById ($o_form, "username") $o_password =_IEFormElementGetObjByName ($o_form, "password") ;~ $o_password = _IEGetObjById ($o_form, "password") $username = "test" $password = "test" _IEFormElementSetValue ($o_login, $username) _IEFormElementSetValue ($o_password, $password) WinSetState ( "Internet", "", @SW_MAXIMIZE ) As you can see i tried both the frame method as the form method. Sadly to say, both did not work. Appreciate any pointer to an efficient solution. (Other then using the mouseclick method) Thanks in advanced for the creative mind that can solve this one. You rock! Link to comment Share on other sites More sharing options...
water Posted May 2, 2020 Share Posted May 2, 2020 Every function returns errors by either setting the return value or the macros @error and/or @extended. So please make sure every _IE* functions runs without errors. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Danp2 Posted May 2, 2020 Share Posted May 2, 2020 Have you tried replacing this line -- $o_form = _IEFrameGetObjByName ($oIE, "loginForm") with this? $o_form = _IEFormGetObjByName ($oIE, "loginForm") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted May 2, 2020 Share Posted May 2, 2020 This works : #include <IE.au3> $oIE = _IECreate ("https://www.klikvoorwonen.nl/mijn-klik-voor-wonen/inloggen/") Sleep(2000) $o_login = _IEGetObjById ($oIE, "username") ConsoleWrite ("username " & IsObj($o_login) & @CRLF) $o_password = _IEGetObjById ($oIE, "password") ConsoleWrite ("password " & IsObj($o_password) & @CRLF) $username = "test" $password = "test" _IEFormElementSetValue ($o_login, $username) _IEFormElementSetValue ($o_password, $password) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Flum Posted May 2, 2020 Author Share Posted May 2, 2020 hello fellow scripters, yes you both are right, and i leaned some more tricks in the mean time. The code below finds both input fields and assign them accordingly to an object then tries to send out the form. There is one big obstacle we still got to tackle. The error handling on there website refrains the script below to send out the form. (It thinks the input fields are empty) Any ideas? #include <IE.au3> Local $oUser, $oPass, $oSubmit Local $sUser = "testUsername" Local $sPass = "testPassword" Local $url = "https://www.klikvoorwonen.nl/mijn-klik-voor-wonen/inloggen/" Local $oIE = _IECreate($url, 1) _IELoadWait($oIE) $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 = "Inloggen" 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) Link to comment Share on other sites More sharing options...
Nine Posted May 2, 2020 Share Posted May 2, 2020 (edited) With my code, I see the changes occurring in the fields. If you want to set value like you did, you need to fire events : $oObject.fireEvent("OnChange") $oObject.fireEvent("OnClick") Edited May 2, 2020 by Nine Danp2 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Flum Posted May 3, 2020 Author Share Posted May 3, 2020 (edited) Hi Nine, i did not need to add the fireEvent code to my code to make it work. Seems like both our codes do the job filling the in the input fields. The next problem i stumble up is that after i submit the form, it wont actually submit. Because the underlying code on the form thinks that the input fields are empty while they are not!? I checked there website source code and i think it has something to do with the code below: Not sure how to solve this!? Edited May 3, 2020 by Flum Link to comment Share on other sites More sharing options...
Danp2 Posted May 3, 2020 Share Posted May 3, 2020 5 hours ago, Flum said: i did not need to add the fireEvent code to my code to make it work. Did you try to see if it makes a difference when you submit the form? P.S. The site uses jQuery, so you may need to trigger some additional events for everything to work correctly Latest Webdriver UDF Release Webdriver Wiki FAQs 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