Rkey Posted May 15, 2009 Share Posted May 15, 2009 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 More sharing options...
Zedna Posted May 15, 2009 Share Posted May 15, 2009 Maybe as workaround you can get source of whole page by _IEBodyReadHTML() or _IEBodyReadText() and search for error (label/text) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Juvigy Posted May 15, 2009 Share Posted May 15, 2009 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 More sharing options...
Rkey Posted May 15, 2009 Author Share Posted May 15, 2009 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 More sharing options...
Moderators big_daddy Posted May 15, 2009 Moderators Share Posted May 15, 2009 $oDivs = _IETagNameGetCollection($oIE, "DIV") For $oDiv In $oDivs If String($oDiv.className) = "error" Then ConsoleWrite($oDiv.innerText & @CR) EndIf Next Link to comment Share on other sites More sharing options...
Rkey Posted May 18, 2009 Author Share Posted May 18, 2009 $oDivs = _IETagNameGetCollection($oIE, "DIV") For $oDiv In $oDivs If String($oDiv.className) = "error" Then ConsoleWrite($oDiv.innerText & @CR) EndIf Next This one really nails it down, this works excellent. Thanks all for your help. Rick 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