Jump to content
Sign in to follow this  
Steve26

IE Get Text From Browser

Recommended Posts

Steve26

Good morning all,

I am in the process of trying to write a script that reads some text off of an IE window.

I believe my issue is that the page I am trying to read the information from, does not have a "name" attribute. Because of this i believe the _IEFormElementGetObjByName is not working. Below is some of my code:

Snippet to Read The Form:

$oIE = _IECreate("http://*******")
$oForm = _IEFormGetObjByName ($oIE, "userinfo")
$oText = _IEFormElementGetObjByName ($oForm, "birthdate")
MsgBox(0, "Form Element Value", _IEFormElementGetValue ($oText))

Form to be read:

<form name="userinfo" method="POST">
        <tr>
          <td align="right"><span class="text10">Birthdate:&nbsp;</span></td>
          <td><span class="text12" id="birthdate"><strong>21 Mar 1980</strong>&nbsp;</span></td>
        </tr>

When i run the script i get the message box saying, "Form Element Value: 0". I am unable to edit the HTML for the site i am trying to access.

Any help is greatly appreciated!

Thanks.

Share this post


Link to post
Share on other sites
Pain

name="userinfo"

id="birthdate"

but then you have to use _IEGetObjById instead.

Edited by Pain

Share this post


Link to post
Share on other sites
Steve26

I changed the code to what you said so it gives me:

$oIE = _IECreate("http://*******")
$oForm = _IEFormGetObjByName ($oIE, "userinfo")
$oText = _IEGetObjById ($oForm, "birthdate")
MsgBox(0, "Form Element Value", _IEFormElementGetValue ($oText))

and the message box still returns 0.

Share this post


Link to post
Share on other sites
Steve26

Errors that the console is sending me:

--> IE.au3 V2.4-0 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch

--> IE.au3 V2.4-0 Warning from function _IEGetObjById, $_IEStatus_NoMatch (birthdate)

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

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  

×