qontro1 Posted October 14, 2016 Share Posted October 14, 2016 Hi, I am trying to automate authentication to this web application, and whilst the fields are populated using the below script, it does not seem to activate the submit button, that is, it CAN'T be pressed. I have tried using IEActions such as click/focus prior to input, doesn't seem to work. I need to enter a character manually into each field before it is activated. Any suggestions appreciated. Thank you. Code and form below. #include <IE.au3> Global Const $exe = "C:\Program Files (x86)\Internet Explorer\iexplore.exe https://10.0.0.1" Global Const $un = "abcdefg" Global Const $pw = "1234567" Run($exe) WinWait("Title - Internet Explorer") WinActive("Title - Internet Explorer") Sleep(2000) Local $oIE = _IEAttach("","instance",1) Local $oForm = _IEFormGetCollection($oIE, 0) Local $unfield = _IEFormElementGetCollection($oForm, 0) Local $pwfield = _IEFormElementGetCollection($oForm, 1) Local $oSubmit = _IEFormElementGetCollection($oForm, 2) _IEFormElementSetValue($unfield, $un) _IEFormElementSetValue($pwfield, $pw) _IEAction($oSubmit,"click") <form data-bind="submit: login, visible: !pvm.loggingIn()" role="form" lpformnum="1"> <div class="form-group"> <label>Username</label><input class="form-control" data-bind="textInput: username" placeholder="enter your username" type="text" style="background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAAAXNSR0IArs4c6QAAAPhJREFUOBHlU70KgzAQPlMhEvoQTg6OPoOjT+JWOnRqkUKHgqWP4OQbOPokTk6OTkVULNSLVc62oJmbIdzd95NcuGjX2/3YVI/Ts+t0WLE2ut5xsQ0O+90F6UxFjAI8qNcEGONia08e6MNONYwCS7EQAizLmtGUDEzTBNd1fxsYhjEBnHPQNG3KKTYV34F8ec/zwHEciOMYyrIE3/ehKAqIoggo9inGXKmFXwbyBkmSQJqmUNe15IRhCG3byphitm1/eUzDM4qR0TTNjEixGdAnSi3keS5vSk2UDKqqgizLqB4YzvassiKhGtZ/jDMtLOnHz7TE+yf8BaDZXA509yeBAAAAAElFTkSuQmCC"); background-repeat: no-repeat; background-attachment: scroll; background-size: 16px 18px; background-position: 98% 50%; cursor: auto;" autocomplete="off"> </div> <div class="form-group"> <label>Password</label><input class="form-control" data-bind="textInput: password" type="password" style="background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAAAXNSR0IArs4c6QAAAPhJREFUOBHlU70KgzAQPlMhEvoQTg6OPoOjT+JWOnRqkUKHgqWP4OQbOPokTk6OTkVULNSLVc62oJmbIdzd95NcuGjX2/3YVI/Ts+t0WLE2ut5xsQ0O+90F6UxFjAI8qNcEGONia08e6MNONYwCS7EQAizLmtGUDEzTBNd1fxsYhjEBnHPQNG3KKTYV34F8ec/zwHEciOMYyrIE3/ehKAqIoggo9inGXKmFXwbyBkmSQJqmUNe15IRhCG3byphitm1/eUzDM4qR0TTNjEixGdAnSi3keS5vSk2UDKqqgizLqB4YzvassiKhGtZ/jDMtLOnHz7TE+yf8BaDZXA509yeBAAAAAElFTkSuQmCC"); background-repeat: no-repeat; background-attachment: scroll; background-size: 16px 18px; background-position: 98% 50%; cursor: auto;" autocomplete="off"> </div> <button class="btn btn-default" data-bind="enable: enableLoginButton" type="submit" disabled="">Log In</button> </form> Link to comment Share on other sites More sharing options...
Danp2 Posted October 14, 2016 Share Posted October 14, 2016 Have you tried _IEFormSubmit? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
qontro1 Posted October 15, 2016 Author Share Posted October 15, 2016 Yeah the problem is that the text doesn't seem to be activating the button, as in, you can't click it. Link to comment Share on other sites More sharing options...
Danp2 Posted October 15, 2016 Share Posted October 15, 2016 You need to examine the code within the HTML page to determine what event (onkeypress, onkeyup, etc) they are expecting. Then you could use fireEvent to force it to occur. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
snooffy Posted October 13, 2021 Share Posted October 13, 2021 (edited) Guys, did this get resolved? I bumped to the same problem. Got an embedded IE in an app with a login form I need to automate. The form has no name or ID, but I can fill in the fields using this method: $formLogin = _IEGetObjById ($oIE, "usernameField") $formLogin.value = "Tester" Also tried this method to fill in the form with the same result _IEFormElementSetValue($formLogin, "Tester") But even I do that, the login button will not activate. I checked the source of the HTML and it has indeed a Javascript taking care of the button: function updateLoginButton() { var loginButton = document.getElementById('loginButton'); var username = document.getElementById('usernameField').value; var password = document.getElementById('passwordField').value; loginButton.disabled = !(username.length > 0 && password.length > 0); } The only test it does is the username and password length, but no onevent or on change or onkeydown i could find, I tried to include $formLogin.fireEvent("onKeydown") trying multiple "onchange" "onkyeup" on both fields, with no luck, to get the button activated I need to click in the filed and type in any of the 2 fields 1 stroke and then the button activates. I could physically click to the fields and send the keystrokes, but I do not want to bring the app forward and rely on the position of the app. I'm not able to address the fields in other methods than described above. Any ideas or direction would be appreciated. I tried to search for it. But either not good at searching or people don't post their solutions. Edited October 13, 2021 by snooffy Link to comment Share on other sites More sharing options...
snooffy Posted October 13, 2021 Share Posted October 13, 2021 Okay I used ControlSend instead ControlSend($window, "", "Internet Explorer_Server1", "Tester{TAB}tester12") And it works. It took me a little while to get the handle of the window. I had to use the class number I got from AU3Info and then I could use the ControlSend to work properly. 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