Reputation: 153
I'm trying to extract the answer text on the following webpage. I opened up the DOM inspector and got the class of the text as "answer_content"
. I've defined a method that looks like:
def get_answer()
@browser.div(:class, "answer_content")
end
puts page.get_answer.text
However, this prints an empty spring. Did I identify the wrong element? When I look at it in the DOM inspector, there does seem to be nothing in between the div
s.
Upvotes: 1
Views: 1024
Reputation: 57312
Looks to me that there are more than one div
elements with that class
. This will tell you if my guess was correct:
@browser.divs(:class, "answer_content").size
Upvotes: 1