Chance1 Posted July 6, 2017 Author Share Posted July 6, 2017 I got it! I am not usre why I didn't try this before but I was going off the controlsend {ENTER} idea. This code works _IEFormElementSetValue ($o_user, $TargetUsername) Sleep(200) _IEFormElementSetValue ($o_password, $TargetPassword) Sleep(200) _IEFormElementSetValue ($o_signin, "{ENTER}") the first two populate the username and the password portions for the form, the last one hits the sign in button. Thank you to the guys who helped, I really appreciate it. Link to comment Share on other sites More sharing options...
Chance1 Posted July 6, 2017 Author Share Posted July 6, 2017 Thinking about it now, I didn't need to click the button, all I had to do was send an {ENTER} while in either of the username or password fields. Hitting enter acts like hitting the Sign In button. So, I actually do not know if my could about is actually hitting enter of the sign in button or just hitting enter while being in a field causing the sign in to occur. Link to comment Share on other sites More sharing options...
Chance1 Posted July 6, 2017 Author Share Posted July 6, 2017 i just went back and tested my code using _IEFormElementSetValue ($o_user, $TargetUsername) Sleep(200) _IEFormElementSetValue ($o_password, $TargetPassword & "{ENTER}") Sleep(200) ; _IEFormElementSetValue ($o_signin, "{ENTER}") So that the last line is commented out and the sign in did NOT occur. That being said, I would need to have the last line code in order to sign in. Link to comment Share on other sites More sharing options...
Danp2 Posted July 6, 2017 Share Posted July 6, 2017 Look at the example I referenced. The correct line to get the handle is Local $hWnd = _IEPropertyGet($oIE, "hwnd") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted July 6, 2017 Share Posted July 6, 2017 14 minutes ago, Chance1 said: _IEFormElementSetValue ($o_signin, "{ENTER}") Never seen the function used like that. I wonder if it would have the same result no matter what you use for the 2nd parameter. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Chance1 Posted July 6, 2017 Author Share Posted July 6, 2017 (edited) 8 minutes ago, Danp2 said: Never seen the function used like that. I wonder if it would have the same result no matter what you use for the 2nd parameter. You are correct, when I have only "" in the second parameter, the command still works, meaning the sing in button is hit. Could that be because of how I get the object? Local $o_signin = _IEFormElementGetObjByName ($o_form, "SUBMIT_BUTTON") Edited July 6, 2017 by Chance1 Link to comment Share on other sites More sharing options...
Gianni Posted July 7, 2017 Share Posted July 7, 2017 12 hours ago, Chance1 said: i just went back and tested my code using _IEFormElementSetValue ($o_user, $TargetUsername) Sleep(200) _IEFormElementSetValue ($o_password, $TargetPassword & "{ENTER}") Sleep(200) ; _IEFormElementSetValue ($o_signin, "{ENTER}") So that the last line is commented out and the sign in did NOT occur. That being said, I would need to have the last line code in order to sign in. Could you try what happens in this way? _IEFormElementSetValue ($o_user, $TargetUsername) Sleep(200) _IEFormElementSetValue ($o_password, $TargetPassword & @CR ) ; or also @CRLF Sleep(200) ; _IEFormElementSetValue ($o_signin, "{ENTER}") SkysLastChance 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Chance1 Posted July 7, 2017 Author Share Posted July 7, 2017 6 hours ago, Chimp said: Could you try what happens in this way? _IEFormElementSetValue ($o_user, $TargetUsername) Sleep(200) _IEFormElementSetValue ($o_password, $TargetPassword & @CR ) ; or also @CRLF Sleep(200) ; _IEFormElementSetValue ($o_signin, "{ENTER}") Yes That does work! Link to comment Share on other sites More sharing options...
Chance1 Posted July 7, 2017 Author Share Posted July 7, 2017 I am working on automating a different javascript doing a similar procedure but the javascript is different then what it was with the last one. So far, I am able to populate the username and password, but I have had no luck clicking the Sign In button again. This is due to the fact that the java script is different. They are not in a form, so I collect the fields like this: Local $o_user = _IEGetObjByName ($oIE, "pt1:_pt_it1") ;text box for sign in Local $o_password = _IEGetObjByName ($oIE, "pt1:_pt_it2") ;text box for password Local $o_signin = _IEGetObjById ($oIE, "pt1:_pt_cb1") ;have to get obj by ID because there is no name for it And the javascript for the button looks like this: <button class="x7j p_AFTextOnly" id="pt1:_pt_cb1" onclick="return false;">Sign In</button> I tried the following with no luck: _IEAction($o_signin, "click") _IEFormElementSetValue ($o_user, $TargetUsername) ;enter in username Sleep(2000) _IEFormElementSetValue ($o_password, $TargetPassword & @CR); Enter a password -- & @CR to hit enter -- doesn't work _IEFormElementSetValue ($o_signin, "") ;strike the "Sign In" button The last of those two actually working on the previous script. Link to comment Share on other sites More sharing options...
Danp2 Posted July 7, 2017 Share Posted July 7, 2017 What about using _IEFormSubmit? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Chance1 Posted July 7, 2017 Author Share Posted July 7, 2017 (edited) doesn't work, there is no form. Or I just cannot find the form. I even tried _IEFormSubmit($oIE) and that doesn't work either Edited July 7, 2017 by Chance1 Link to comment Share on other sites More sharing options...
Danp2 Posted July 7, 2017 Share Posted July 7, 2017 Maybe this? -- $o_signin.click() If not, then you need to examine that element in the Developer Tools app (F12) because it probably has some events attached to it that need to be properly triggered. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Chance1 Posted July 7, 2017 Author Share Posted July 7, 2017 so that didn't work either. I am looking throught the developer tool and am not finding too much. I have attaed a screenshot of the script. You can see a bunch of things being triggered before the signon button, but non of those are actually changing the sign in. There is no function that it runs onclick. The table is just the window that the fields are being displayed in. Not to sure what to do at this point. Thanks guys for all of your help. Link to comment Share on other sites More sharing options...
Danp2 Posted July 7, 2017 Share Posted July 7, 2017 Select the element and then look for anything under the Events tab on the right side of the window Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Chance1 Posted July 7, 2017 Author Share Posted July 7, 2017 (edited) I get that onclick is an event and then on the right side of that same window it says signin(2). When I click on it get to a window that is just filled up with javascript. Not sure how to decipher this. edit: all of the onclick commands in the seperate window are all set to "return false" Edited July 7, 2017 by Chance1 Link to comment Share on other sites More sharing options...
Danp2 Posted July 7, 2017 Share Posted July 7, 2017 Unfortunately, I'm unable to provide any further assistance without the URL or the code from the site, Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Gianni Posted July 8, 2017 Share Posted July 8, 2017 maybe like this? ...worth a try... Local $o_user = _IEGetObjByName ($oIE, "pt1:_pt_it1") ;text box for sign in Local $o_password = _IEGetObjByName ($oIE, "pt1:_pt_it2") ;text box for password Local $o_signin = _IEGetObjById ($oIE, "pt1:_pt_cb1") ;have to get obj by ID because there is no name for it _IEFormElementSetValue ($o_user, $TargetUsername) ; enter in username _IEFormElementSetValue ($o_password, $TargetPassword ) ; Enter a password _IEAction ($o_signin, "focus"); set focus to button ControlSend(_IEPropertyGet($oIE, "hwnd"), "", "", "{ENTER}"); send "enter" to IE Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... 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