CaptainBeardsEyesBeard Posted July 16, 2019 Share Posted July 16, 2019 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? Link to comment Share on other sites More sharing options...
Nine Posted July 16, 2019 Share Posted July 16, 2019 It is not $ObjID.Value that you should check on for a button. It is $ObjID.innerText... Danp2 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted July 16, 2019 Author Share Posted July 16, 2019 that worked! thanks 👌 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