Jump to content

Recognizing IE page by context


Recommended Posts

Good day,

I'm currently working on a script that is able to autofill an employee database by filling in webforms. The webforms are on a secured network and mainly uses Java. It has to be entered into several pages, which al have online validations. Those validations take place after filling in the whole page (the total employee forms take 4 pages).

So far I've written the script to open the page, navigate to the insert employee page and fill in all field available. After submitting the form there are two options:

-Option 1 is all field are correctly filled and form 2 out of 4 is shown

-Option 2 there is an error shown and page 1 out of 4 remains on the screen.

I now have problems detecting if there is an error message shown on the page.

The error message is shown in a form but doensn't have a name or an ID that i can recognize and I can't get to the .css because they are secured. I tried to get the form element by name, guessing the name would be equal to the classname. No luck here. I also made a form element collection with all the values, but none of them shows the value of this element.

This is the error message, which is shown on the form as well.

CODE

<DIV CLASS="orderedlayout">

<TABLE CELLSPACING="0" CELLPADDING="1" BORDER="0" WIDTH="100%">

<TR>

<TD VALIGN="top" >

<DIV CLASS="error" ALIGN="left" >

M1M 1005A Date has to be entered

</DIV>

</TD>

</TR>

</TABLE>

</DIV>

I tried:

CODE

$oForm = _IEFormGetObjByName ($oIE, "mainform")

$oSelect = _IEFormElementGetObjByName ($oForm, "error")

$value = _IEFormElementGetValue($oSelect)

MsgBox(1, "", $value)

and this to get all values:

CODE

$oForm = _IEFormGetCollection ($oIE, 0)

for $v = 1 to 100

$oQuery = _IEFormElementGetCollection ($oForm, $v)

$var = _IEFormElementGetValue($oQuery)

MsgBox(1, "", $var)

Next

I'd appreciate any help already in advance,

Kind regards,

Rick

Link to comment
Share on other sites

Check this out - it works for me:

$oIE = _IECreate("C:\Documents and Settings\xxxx\Desktop\event.html",1,1,1,0)
    $oDoc = _IEDocGetObj($oIE)
    $oArray = $oDoc.getElementsByTagName ("div")

For $element in $oArray
    MsgBox(0,"",$element.innertext)
Next

C:\Documents and Settings\xxxx\Desktop\event.html is the source code you provided.

Link to comment
Share on other sites

Thanks for the replies,

Bodyread works great for me, since all errors start with 'M1M '.

I'll also try the Tagname version.

I'll try it and update is after this weekend.

Thanks again.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...