ruby - Nokogiri stopped searching for sub tags -
i writing ruby (2.0) script reads web page & working fine. installed ruby 2.2 , nokogiri stopped searching sub tags not all. still finds sub tag , aren't being found in same script. reverted 1.9 still doing same thing. have installed ruby 2.1.6. loading pages watir-webdriver , open-uri. following page being opened open-uri.
for example, here code:
htmlpage = '<html> <head></head> <body> <table width="100%" border="1"> <tbody> <tr valign="top"> <td width="38%" bgcolor="#efefef"> <b> <font size="4">npl listing history</font> </b> </td> <td width="62%" bgcolor="#efefef"> <b> <font size="4">dates</font> </b> </td> </tr> </tbody> </table> </body> <html>' page = nokogiri::html(htmlpage) puts page.css("table [border='1']") this should me table border 1 nil/null.
am doing wrong? or missing?
thanks!
your problem space. in css selectors whitespace descendant combinator, table [border='1'] means "all descendants of table have border attribute equal 1. want table[border='1'], means "all table elements have border attribute equal 1."
Comments
Post a Comment