Tasos
Tasos

Reputation: 1637

Cannot narrow down an xpath using mechanize in ruby to extract a table

I'm trying to get the data contained after this highlighted td tag:

enter image description here

(screenshot taken from firefox developer tools)

but I don't understand how I'm going to get there. I tried to use xpath

page.parser.xpath("//table//tbody//tr//td//ul//form//table//tbody//tr/td")

but this doesn't work and I assuming it's because I'm not identifying anything? I am not sure how I'm going to identify stuff though, since some of them have no ids or names. So the question is how do I reach this tag.

Upvotes: 0

Views: 126

Answers (1)

pguardiario
pguardiario

Reputation: 55002

Probably because the tbody isn't really there. There's a lot of discussion on SO about that particular issue.

Here's how what I would probably do:

td = page.at '#tF0 .txt2'

Upvotes: 2

Related Questions