CaptainBeardsEyesBeard Posted June 25, 2019 Posted June 25, 2019 (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 June 25, 2019 by CaptainBeardsEyesBeard
FrancescoDiMuro Posted June 25, 2019 Posted June 25, 2019 @CaptainBeardsEyesBeard The name and the Help file should suggest you how to use this function at your advantage. $objFound = _IEGetObjById($objIE, "clientCode") If Not @error Then ConsoleWrite($objFound.Value & @CRLF) Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
CaptainBeardsEyesBeard Posted June 25, 2019 Author Posted June 25, 2019 That's great thanks! Also how would I create the object of IE against an existing internet explorer window? As _IECreate creates a window
FrancescoDiMuro Posted June 25, 2019 Posted June 25, 2019 15 minutes ago, CaptainBeardsEyesBeard said: As _IECreate creates a window Not if you specify that you don't want to show it Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
CaptainBeardsEyesBeard Posted June 25, 2019 Author Posted June 25, 2019 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
FrancescoDiMuro Posted June 25, 2019 Posted June 25, 2019 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: Forum Rules Forum Etiquette
CaptainBeardsEyesBeard Posted June 25, 2019 Author Posted June 25, 2019 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
FrancescoDiMuro Posted June 25, 2019 Posted June 25, 2019 (edited) 19 minutes ago, CaptainBeardsEyesBeard said: if StringInStr($oForm,"AVI800") then You are trying to compare an object with a string; it will never do what you want. Try to change the lines above with: If StringInStr($oForm.Value, "AVI800") Then Edited June 25, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
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