Reputation: 47
I want to extract data ["Over/Under +0.5", "1.04", "11.46", "95.3%"] by using python(selenium) for more than 10 pages but I have a problem with getting the exact value with Xpath inside the table the number inside div[] change in each web page is there any way to get to the same value inside the table? for example : page1
'//*[@id="odds-data-table"]/div[12]/div/strong'
page2
'//*[@id="odds-data-table"]/div[11]/div/strong'
Upvotes: 0
Views: 85
Reputation: 5905
The following XPath should work :
//div[@class="table-header-light odd first"]//*[contains(text(),".")][not(parent::strong)]
Output : 3 nodes > Over/Under/Payout
If you want to keep the "Over/Under +0.5" element :
//div[@class="table-header-light odd first"]//*[contains(text(),".")]
or
(//div[@class="table-header-light odd first"]//text())[position()<=4]
Output : 4 nodes
Upvotes: 1