Xpath getting numeric value in a table -
i need help, im new xpath. want extract data xml below xpath.
xml : <td class="pprice" style xpath="1">$4,124,000 </td>==$0
xpath: //table/tbody//tr//td[[@class="pprice"]<1000000]
how price less 1,000,000
, error na.
please help.
you can try below :-
//td[@class='pprice'][. > 4124000]
or
//table/tbody//tr//td[[@class="pprice"][. > 4124000]
or
you can use translate
keyword of xpath
translate(.,translate(., '0123456789,', ''), '')
the output be
4,266,240678,260825,0002,185,000589,0007,789,4723,375,0007,780,0001,972,0002,560,0002,541,0001,523,5003,975,0002,845,0004,124,0004,111,0000
or
translate(.,translate(., '0123456789', ''), '')
it return
42662406782608250002185000589000778947233750007780000197200025600002541000152350039750002845000412400041110000
you can specify element location below:
//td[@class='pprice']/translate(.,translate(., '0123456789', ''), '')
or more specific below:
//table/tbody//tr[2]//td[@class='pprice']/translate(.,translate(., '0123456789', ''), '')
additionally, can use below function of xpath mentioned in below url
https://www.iro.umontreal.ca/~lapalme/forestinsteadofthetrees/html/ch04s02.html
hope you
Comments
Post a Comment