jmp Posted August 19, 2019 Posted August 19, 2019 I am trying to read 310.00 from <td>, But it returning empty #include <IE.au3> #include <Array.au3> $oIE = _IEAttach ("Shop") Local $totPri = '<td style="text-align: right;" colspan="5">Total Price </td>' , $totPri = "0" Local $oTds = _IETagNameGetCollection($oIE, "td") For $oTd In $oTds If $oTd.InnerText = $totPri Then $totPri = $oTd.NextElementSibling.innertext EndIf Next MsgBox (0, "", $totPri) HTML :
Gianni Posted August 19, 2019 Posted August 19, 2019 (edited) I would try to read the whole table with the _IETableWriteToArray () function and then analyze the data in the returned array, I think it should be more convenient. however, in your script you declare the variable $totPri first with a string and immediately after with a "0". Local $totPri = '<td style="text-align: right;" colspan="5">Total Price </td>' , $totPri = "0" Since the InnerText property returns only the contents of the cell and not the entire Tag, you should compare the string returned by $oTd.InnerText with "Total Price". then try declaring the variable as Local $totPri = "Total Price" and it should work. Edited August 19, 2019 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
jmp Posted August 21, 2019 Author Posted August 21, 2019 i am trying to get text from label between <td> tag but it was say not found. #include <IE.au3> $oIE1 = _IEAttach ("Shop") Local $stext = ' Bhindi' ;~Local $oTds = _IETagNameGetCollection($oIE1, "label") Local $oTds = _IETagNameGetCollection($oIE1, "td") For $oTd In $oTds If $oTd.InnerText = $stext Then $iStext = $oTd.NextElementSibling.InnerText MsgBox(0, "Found", $iStext) Else MsgBox(0, "", "Not Found") EndIf Next <tr title="" style="width: 25px;" data-original-title= Enter amount to take!" data-toggle="tooltip" data-placement="bottom"> <td><label for=""> Bhindi</label> </td> <td>10.500</td> <td>32.00</td> <td>
Danp2 Posted August 21, 2019 Posted August 21, 2019 Isn't this the same problem as described in your previous thread? If so, why not respond there instead of starting all over in a new one? Latest Webdriver UDF Release Webdriver Wiki FAQs
jmp Posted August 21, 2019 Author Posted August 21, 2019 15 minutes ago, Danp2 said: Isn't this the same problem as described in your previous thread? If so, why not respond there instead of starting all over in a new one? @Danp2 My previous problem is solved, but this is my different problem, there are text in label.
Danp2 Posted August 21, 2019 Posted August 21, 2019 I dunno... looks like the same basic problem to me. <shrug> I would suggest two things -- Add a consolewrite so that you can see what elements are actually being found / processed in the For loop Use StringInStr to look for the desired text instead of equals Latest Webdriver UDF Release Webdriver Wiki FAQs
Developers Jos Posted August 21, 2019 Developers Posted August 21, 2019 2 hours ago, jmp said: @Danp2 My previous problem is solved, but this is my different problem, there are text in label. Does look the same to me as well, and since you didn't have the courtesy to report as such, one can only assume it is the same .... Merged and stick to one thread in the future! Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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