Sibtain Norain
Sibtain Norain

Reputation: 679

Xpath Query to select rows from a table

I have a web page which has a table with rows of 2 types, Recommended Recyclers and Trade In Prices.

I want to select only those rows from the table which are under Recommended Recyclers category only.
Here is the link of web page: http://www.sellmymobile.com/phone/orange-spv-m5000/

I need xpath for this selection.

Upvotes: 0

Views: 1626

Answers (1)

hr_117
hr_117

Reputation: 9627

Here a xpath mostly according the explanation form Wrikken.

"//tr[
      preceding-sibling::tr[td/@class='section-head']
      [1]
      [ contains(td, 'Recommended Recyclers')]
     ][not (td/@class='section-head')]"

With small differences: Looking for all tr where the first presiding tr with "@class='section-head'" contains an td which contains "Recommended Recyclers". But only tr which has not an td with "@class='section-head'".

Upvotes: 1

Related Questions