KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
how can I check during parsing of an HTML page with Nokogiri (Ruby gem) if an element, in this case a div, exists on the page? On my test page, it does exist, so the pp yields the expected Nokogiri output. But the if statement does not work, the == true seems to be the wrong way to go about it. Any suggestions for improvement? Cheers, Chris pp page.at('.//div[@class="errorMsg"]') if page.at('.//div[@class="errorMsg"]') == true then puts "Error message found on page" end
Tags (comma-separated)
Save Edits
Cancel