Jump to content

Recommended Posts

Posted (edited)

Hi, 

 

So I'm trying to test a field in IE 

 

If I do an inspect element on the IE page I get this

 

<input name="clientCode" class="form-control error" id="clientCode" aria-invalid="true" aria-required="true" required="" type="text" value="AVI800">

how would I use  _IEGetObjById to test the value? 

 

Edit: Also the way my automation is working it opens a Web page from another application. Would I use _IECreate here? 

Or something else to identify the window  

Edited by CaptainBeardsEyesBeard
Posted

Ah Yes I see! Thanks! 

 

However when running it now it appears to produce 0 for the value I parse from the object ID. 

 

Here's my code  

 

Local $oIE = _IECreate($IETEstPage, 1)
; Check @extended return value to see if attach was successful
If @extended Then
    MsgBox($MB_SYSTEMMODAL, "", "Attached to Existing Browser", 4)
Else
    MsgBox($MB_SYSTEMMODAL, "", "Created New Browser", 4)
EndIf

_IELoadWait($oIE)
Local $oForm = _IEFormGetObjByName($oIE, "clientCode")
if StringInStr($oForm,"AVI800") then
      MsgBox($MB_SYSTEMMODAL, "Test Result  ", "Test Passed:  matches", 4)
      FileWrite($hFilehandle, @CRLF & "Test" & $TestCount & "Test Passed:    matches " & $oForm)
   Else
       MsgBox($MB_SYSTEMMODAL, "Test Result ", "Test Failed: doesn't match"& $oForm, 4)
        FileWrite($hFilehandle, @CRLF & "TestTest Failed:    doesn't match " )
       Sleep(4000)
   EndIf
exit

And when I check the file (as well as the msgbox that comes up) I get '0' for the value 

 

TestTest Failed:      doesn't match0

 

Posted
4 minutes ago, CaptainBeardsEyesBeard said:

Local $oForm = _IEFormGetObjByName($oIE, "clientCode")

If you have more than a form in the page, you may use the index parameter of the function _IEFormGetObjByName, or passing the Form  object to this function.
Try to put a ConsoleWrite() before the StringInStr() to display the .Value of the object you are look for :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Posted

Whoops I meant to have get by by ID there so it should read 

 

So I've just changed it to 

 

Local $oForm = _IEGetObjById($oIE, "clientCode")

And now when I check the text file which should output the $oForm the value doesn't show at all. 

 


 

Quote

TestTest Failed:      doesn't match

 

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
×
×
  • Create New...