Jump to content
Sign in to follow this  
CaptainBeardsEyesBeard

Checking a field in Internet Explorer

Recommended Posts

Hi there, 

 

I have a function to test checking a field in Internet Explorer 

Func CheckAField_In_InternetExplorer($ObjID, $ObjExpected, $FieldBeingTested)
   if StringInStr($ObjID.Value,$ObjExpected) then
      MsgBox($MB_SYSTEMMODAL, "Test Result for field    " & $FieldBeingTested, "Test Passed:  matches"& $ObjID.Value, 4)
      FileWrite($TestResults, @CRLF & "Test" & $TestCount & "Test Passed:    matches " & $ObjID.Value)

   Else
       MsgBox($MB_SYSTEMMODAL, "Test Result ", "Test Failed: doesn't match"& $ObjID.Value & "", 4)
        FileWrite($TestResults, @CRLF & "Test " & $TestCount & "Test Failed:"& $FieldBeingTested & "     doesn't match" & $ObjID.Value)
       Sleep(4000)
    EndIf
$TestCount = $TestCount +1
    EndFunc

I then am using this function in my main file

   ;/************************* Start URL for compliance letters **************************/
Local $oIE = _IECreate("http://testurl/testapp", 1)
Sleep(10000)
if WinSetState($ApplicationWindow, "", @SW_MAXIMIZE) Then


Else
   Sleep(6000)
   WinSetState($ApplicationWindow, "", @SW_MAXIMIZE)
EndIf


 ;/****************************End*************************************************************/
 
  ;/****************************Test Search button *********************************************/

Sleep(4000)
Local $WebSearch = _IEGetObjById($oIE, "mainSearchButton")
CheckAField_In_InternetExplorer($WebSearch, "Search", "Search Button")
 ;/****************************End*************************************************************/

However the test fails. If I then check the text file which I output logs/results to I get this which seems to not output the $ObjID.Value 


 

Quote

Test 1Test Failed:Search Button       doesn't match

The code for this is

FileWrite($TestResults, @CRLF & "Test " & $TestCount & "Test Failed:"& $FieldBeingTested & "     doesn't match" & $ObjID.Value)

Also see the screenshot attached of the inspect Element page of IE. 

 

Why is my test failing and the $ObjID.Value not being output? 

1.png

Share this post


Link to post
Share on other sites

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...