Skip to content Skip to sidebar Skip to footer

Extract A Single Row From A Table

I’m trying to extract a single row from a table. I'm using google sheet to create the links and in cell D3 it contains this url. https://www.wsj.com/market-data/quotes/AAPL/optio

Solution 1:

For that row you will need:

(//tr[@class='last_trade_row'])[1]/preceding-sibling::tr[1]

And then pick the wright td...it's unclear which td you want. So if you wanted the third td the XPath would be:

(//tr[@class='last_trade_row'])[1]/preceding-sibling::tr[1]/td[3]

Its always the first table that ends with the word LAST TRADE and the row above it that i'm looking to extract, so in this case this is the row that i'm looking to extract, below is the picture.

https://www.wsj.com/market-data/quotes/AAPL/options

enter image description here

In the above case where you want the first td the XPath will then be

 (//tr[@class='last_trade_row'])[1]/preceding-sibling::tr[1]/td[1]

Post a Comment for "Extract A Single Row From A Table"