When I look up an xpath with
b.xpath("td[@class='team']/img").each do |d|
puts d['id']
end
The element “d” is a html node. I can reference attributes in it.
But when I attempt to look up the same element in one line, it gets returned as a string.
c = b.xpath("td[@class='team']/img")[0]
There is only one element I in the array, I don’t need to loop through anything .each. Is there a way to make this one line?
I ended up doing something like this: