view html page
<html> apple orange drugs </html>
how to choose orange color using xpath?
/html/text()[2]
does not work.
You cannot do this directly by selecting. You need to call the xpath line function to cut the text () to get the desired line
substring-after(/html/text()," ") // something like this,
here is a list of string functions
If the lines are split <br>, then they work
<br>
doc = Nokogiri::HTML("""<html> apple <br> orange <br> drugs </html>""") p doc.xpath('//text()[2]') #=> orange
Source: https://habr.com/ru/post/1720377/More articles:Binary Search - algorithmC ++ system () function - How to collect output from issued command? - c ++xpath: how can you select specific node text before and after the tag? - xpathIdiomatic Python has_one - pythonHow do I disable a conversion message when opening an Office 2007 document using Office 2003? - .netVisual Studio 2008 Express Edition - line numbers not displayed? - visual-studio-2008Homework about function growth rate - functionTesting MVC HttpAcceptAttribute Verbs - c #rspec mocks: to check expectations in it "should" methods? - assertionsWhy does writing to an unconnected socket first send SIGPIPE? - posixAll Articles