CaptainBeardsEyesBeard Posted September 3, 2020 Share Posted September 3, 2020 I would like to be able to determine if the highlighted part has a value above 0 To start with I just wanted to return a value using Local $oDiv = _IEGetObjById($oIE, "ctl00_MPH_ctlPaymentsReceivedStatusListing_ctl12_ctlHyperLink") MsgBox($MB_SYSTEMMODAL, "Line1", $oDiv.value) I also tried on inner text Local $oDiv = _IEGetObjById($oIE, "ctl00_MPH_ctlPaymentsReceivedStatusListing_ctl12_ctlHyperLink") MsgBox($MB_SYSTEMMODAL, "Line1", $oDiv.value) However I get a thing telling me that it is not of object type on my console output (75) : ==> Variable must be of type "Object".: MsgBox($MB_SYSTEMMODAL, "Line1", $oDiv.value) MsgBox($MB_SYSTEMMODAL, "Line1", $oDiv^ ERROR >Exit code: 1 Time: 39.26 Link to comment Share on other sites More sharing options...
Danp2 Posted September 3, 2020 Share Posted September 3, 2020 I would use _IETableWriteToArray and then locate the desired value within the array. CaptainBeardsEyesBeard 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted September 3, 2020 Author Share Posted September 3, 2020 28 minutes ago, Danp2 said: I would use _IETableWriteToArray and then locate the desired value within the array. Thanks I'll look into that At the moment I'm not able to return the value correctly though. Is there a better way to return the value than the below? Local $oDiv = _IEGetObjById($oIE, "ctl00_MPH_ctlPaymentsReceivedStatusListing_ctl12_ctlHyperLink") MsgBox($MB_SYSTEMMODAL, "Line1", $oDiv.value) Link to comment Share on other sites More sharing options...
Danp2 Posted September 3, 2020 Share Posted September 3, 2020 You are retrieving the link element, so not sure why you would expect this to give you the value of a table cell. If _IETableWriteToArray doesn't work for you, then perhaps you could use the IE xpath UDF that's floating around the forum. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted September 4, 2020 Author Share Posted September 4, 2020 OK so I tried Local $oTable = _IETableGetCollection($oIE) Local $aTableData = _IETableWriteToArray($oTable) If @error then ConsoleWrite(@CRLF & "Error writing to table array") EndIf _ArrayDisplay($aTableData) and got this --> IE.au3 T3.0-2 Error from function _IETableWriteToArray, $_IESTATUS_InvalidObjectType Error writing to table array>Exit code: 0 Time: 27.1 Link to comment Share on other sites More sharing options...
Danp2 Posted September 4, 2020 Share Posted September 4, 2020 That because you can't pass a collection object to IETableWriteToArray. Change your code to retrieve an individual table by passing an index to _IETableGetCollection. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted September 4, 2020 Author Share Posted September 4, 2020 What would be an index in that instance? Link to comment Share on other sites More sharing options...
Danp2 Posted September 4, 2020 Share Posted September 4, 2020 From the help file -- Quote 0 or positive integer returns an indexed instance The value you use will depending on which table instance you want to target. If there is only one on the web page, then use 0. Otherwise, use whatever value is appropriate to retrieve the desired table. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted September 4, 2020 Author Share Posted September 4, 2020 Thanks using 0 I got a return of the below. I tried 1 also and got an empty table Where would the number of the table be defined? Link to comment Share on other sites More sharing options...
Danp2 Posted September 4, 2020 Share Posted September 4, 2020 It will vary depending on the website involved. You could do something like this to figure it out -- _IETableGetCollection($oIE) $iNumTables = @extended For $i = 0 To $iNumTables - 1 $oTable = _IETableGetCollection($oIE, $i) $aTableData = _IETableWriteToArray($oTable) _ArrayDisplay($aTableData, "Table #" & $i) Next Code is untested, so YMMV. 😉 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted September 7, 2020 Author Share Posted September 7, 2020 That was really great thank you 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