html - How do I select one of 5 child elements which has a unique class name in XPath? -


in linked screenshot below, it's rating out of 5. if 1 star rating given user. html looks this:.

enter image description here

however, if let's 4 star rating given html looks this:

enter image description here

i want user rating "1" or "4" repsctively in screenhots above.

so far have got this:

.//td[@class='review-rating-header seat_comfort']/following-sibling::td[@class='review-rating-stars stars']//span[contains(concat(' ', @class, ' '), ' fill ')] 

this selects "1" rows though user ratings maybe "2", "3", "4" or "5".

i'm web scraping way, if helps.

any ideas on how desired xpath element?

if want last span class fill, try

span[contains(concat(' ', @class, ' '), ' fill ')][last()] 

Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -