I’m using Rails 4.2.7 with Nokogiri. Is there a way I can tell, with Nokogiri, that one of the options in my select menu contains the word "Results" in its text field (that would be visible to the end user)?
options = doc.css("#menu_id option")
Nokogiri supports jQuery's
:contains selector, which selects nodes with the given content:
You could also do it with an XPath, which has more power but is more verbose: