kelso Posted March 21, 2017 Share Posted March 21, 2017 Hi, I'm having a problem with vSphere webpage, for some reason, I can't automate the injection of username and password... <div id="loginForm"> <p class="loginRow"> <span class="loginLabel">User name:</span> <input class="margeTextInput" id="username" type="text"> </p> <p class="loginRow"> <span class="loginLabel">Password:</span> <input class="margeTextInput" id="password" type="password"> </p> <p id="sessionID"> <label id="checkboxLabel"><input disabled="true" id="sspiCheckbox" onchange="enableSspi(this);" type="checkbox">Use Windows session authentication</label> </p> <p id="loginButtonRow"> <input disabled="" class="button blue" id="submit" onclick="submitentry()" type="submit" value="Login"> </p> </div> What I tried: ..... $login_form = _IEGetObjById($ie, "loginForm") $email_field = _IEGetObjById($login_form, "username") $pass_field = _IEGetObjById($login_form, "password") _IEFormElementSetValue($email_field, $email) _IEDocInsertText($email_field, $email) _IEFormElementSetValue($pass_field, $password) _IEDocInsertText($pass_field, $password) .... Also Tried - _IEFormElementGetObjByName instead of _IEGetObjById what am I doing wrong here??? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 21, 2017 Moderators Share Posted March 21, 2017 @kelso why don't you just install the integration plug-in, so you don't have to use a username and password? "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...
kelso Posted March 21, 2017 Author Share Posted March 21, 2017 5 minutes ago, JLogan3o13 said: @kelso why don't you just install the integration plug-in, so you don't have to use a username and password? @JLogan3o13 The integration plug-in will only help me with AD accounts, right? I need this for local accounts as well. Link to comment Share on other sites More sharing options...
Danp2 Posted March 21, 2017 Share Posted March 21, 2017 I would drop the call to _IEDocInsertText as I don't believe you are using it in the intended way. You didn't state where your code was failing, but I'm guessing it's on the calls to _IEGetObjById. Again, I believe you are trying to use it improperly. Try this -- $email_field = _IEGetObjById($ie, "username") $pass_field = _IEGetObjById($ie, "password") _IEFormElementSetValue($email_field, $email) _IEFormElementSetValue($pass_field, $password) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 21, 2017 Moderators Share Posted March 21, 2017 So you're trying to log into the client as a \vSphere.local account? My personal experience trying to automate the login page has never gone well; I finally gave up and just script anything I want to do through PowerCLI rather than trying to do it through the GUI. One of our IUIAutomation gurus may wander along with a suggestion on the web login, though. "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...
kelso Posted March 21, 2017 Author Share Posted March 21, 2017 3 minutes ago, JLogan3o13 said: So you're trying to log into the client as a \vSphere.local account? My personal experience trying to automate the login page has never gone well; I finally gave up and just script anything I want to do through PowerCLI rather than trying to do it through the GUI. One of our IUIAutomation gurus may wander along with a suggestion on the web login, though. My code is not failing, that's the problem. The webpage comes up, all well, like any other webpage that I configured in the past, but for this specific one, it doesn't inject the user/password I use. I tried to drop the _iedocinserttext, no luck. 4 minutes ago, Danp2 said: I would drop the call to _IEDocInsertText as I don't believe you are using it in the intended way. You didn't state where your code was failing, but I'm guessing it's on the calls to _IEGetObjById. Again, I believe you are trying to use it improperly. Try this -- $email_field = _IEGetObjById($ie, "username") $pass_field = _IEGetObjById($ie, "password") _IEFormElementSetValue($email_field, $email) _IEFormElementSetValue($pass_field, $password) Thank you... if anyone have any suggestions, let me know. Link to comment Share on other sites More sharing options...
Danp2 Posted March 21, 2017 Share Posted March 21, 2017 10 minutes ago, kelso said: My code is not failing, that's the problem. I would have expected to see errors in the Scite output window for the last two called to _IEGetObjById because the first parameter is invalid. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
kelso Posted March 21, 2017 Author Share Posted March 21, 2017 7 minutes ago, Danp2 said: I would have expected to see errors in the Scite output window for the last two called to _IEGetObjById because the first parameter is invalid. Can you please explain why is it invalid? the only thing I can see in Scite is IE_v1.au3 the requested action with this object has failed: WEnd WEnd^ ERROR Link to comment Share on other sites More sharing options...
Danp2 Posted March 21, 2017 Share Posted March 21, 2017 Quote _IEGetObjById Returns an object variable by id #include <IE.au3> _IEGetObjById ( ByRef $oObject, $sID ) Parameters $oObject Object variable of an InternetExplorer.Application, Window or Frame object $sID Specifies id of the object you wish to match You were passing an DIV element as the first parameter, which isn't valid based upon my reading of the help file entry for _IEGetObjById. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
kelso Posted March 21, 2017 Author Share Posted March 21, 2017 (edited) 1 minute ago, Danp2 said: You were passing an DIV element as the first parameter, which isn't valid based upon my reading of the help file entry for _IEGetObjById. Thanks, here's the example tho: ; Open a browser to the basic example, get an object reference ; to the DIV element with the ID "line1". Display the innerText ; of this element to the console. #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IE_Example("basic") Local $oDiv = _IEGetObjById($oIE, "line1") MsgBox($MB_SYSTEMMODAL, "Line1", $oDiv.innertext) Edited March 21, 2017 by kelso Link to comment Share on other sites More sharing options...
Danp2 Posted March 21, 2017 Share Posted March 21, 2017 Right, but they didn't then use $oDiv as the input for a subsequent call to _IEGetObjById. Your initial call to _IEGetObjById to get the reference to the Div element should have worked. The following two would fail because of the wrong parameter being passed. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
kelso Posted March 21, 2017 Author Share Posted March 21, 2017 Thanks @Danp2 still no idea why it doesn't work if it is properly configured... 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