Sign in to follow this  
Followers 0
empach

IEObjByName retreival error - warning from function

5 posts in this topic

Hi

I'm having some trouble with an auto login code I'm trying to write, and would like some help :)

Having read the rules, and looking at other threads, I apologise now if this is against the rules, but I don't think it is...

What I'm trying to do...

Create GUI to enter details (user, pass) and save to file.

Create code to open webpage and send details.

Navigate to specific page.

Save a .pdf file from drop down menu to PC

This is the code I have (I appreciate it is not pretty):

#include 

$W = "http://webpage"
$oIE = _IECreate($W, 0, 1, 1, 1)
_IELoadWait ($oIE)


Local $username =_IEGetObjByName ($oIE, "input#ct100$PageBody$userName")
Local $password =_IEGetObjByName ($oIE, "ct100$PageBody$password")
Local $pin = _IEGetObjByName($oIE, "ct100$PageBody$PIN")

_IEFormElementSetValue ($username, "User")
_IEFormElementSetValue ($password, "Pass")
_IEFormElementSetValue ($pin, "Pin")

The biggest part I am having trouble with is send the details to the webpage. It is a .aspx site and I receive the error message:

--> IE.au3 V2.4-0 Warning from function _IEGetObjByName, $_IEStatus_NoMatch (Name: input#ct100$PageBody$userName, Index: 0)

--> IE.au3 V2.4-0 Warning from function _IEGetObjByName, $_IEStatus_NoMatch (Name: ct100$PageBody$password, Index: 0)

--> IE.au3 V2.4-0 Warning from function _IEGetObjByName, $_IEStatus_NoMatch (Name: ct100$PageBody$PIN, Index: 0)

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

>Exit code: 0 Time: 11.325

Does anyone have any ideas how to get the details sent to the webpage??

Thanks in advance!! :)

Share this post


Link to post
Share on other sites



First step is to figure out why your calls to _IEGetObjByName are failing. Can you post some of the html from the relevant portion of the web page?

Share this post


Link to post
Share on other sites

This is part of the HTML I'm trying to reach...

<fieldset>

<div id="ctl00_PageBody_ValidationSummary1" class="warning" style="color:Red;display:none;">

</div>

<label for="userName">

User Name:

</label>

<input name="ctl00$PageBody$userName" type="text" id="ctl00_PageBody_userName" class="small" onclick="return userName_onclick()">

<span id="ctl00_PageBody_reqUN" style="color:Red;visibility:hidden;">*</span>

<br>

<br>

<label for="password">

Password:</label>

<input name="ctl00$PageBody$password" type="password" id="ctl00_PageBody_password" class="small">

<span id="ctl00_PageBody_reqPW" style="color:Red;visibility:hidden;">*</span>

<br>

<br>

<label for="PIN">

PIN:</label>

<input name="ctl00$PageBody$PIN" type="Password" id="ctl00_PageBody_PIN" class="pin">

<span id="ctl00_PageBody_CustomValidatorPIN" style="color:Red;visibility:hidden;"></span>

<!-- <span id="ctl00_PageBody_RequiredFieldValidator1" style="color:Red;visibility:hidden;">*</span> -->

<br>

<br>

<div class="divLogin">

<input type="submit" name="ctl00$PageBody$btnLogin" value="Login" onclick="showLoadingIcon();WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$PageBody$btnLogin&quot;, &quot;&quot;, true, &quot;ValidationSummary1&quot;, &quot;&quot;, false, false))" id="ctl00_PageBody_btnLogin" class="button">

<input type="submit" name="ctl00$PageBody$btnForgotPassword" value="Forgot Password?" id="ctl00_PageBody_btnForgotPassword" class="button">

<div id="myDiv" style="display: none">

<img src="../Images/Login-loader.gif" alt="Loading...">

</div>

<br>

</div>

<br>

<br>

By using this website (through any device) you are agreeing we can set and use cookies.

<br>

Share this post


Link to post
Share on other sites

Two issues that I see:

  • You have "input#" at the beginning of the user name field, which is incorrect
  • I believe you have confused a lower case L for the number one. Change all instances of "ct100" to "ctl00"

Share this post


Link to post
Share on other sites

wow, thank you!! cant believe I've been that stupid!!! :)

Now on to the next problem...

Thanks again!! :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0