Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目前我正在做以下事情:
if( firstTemp == true ) total = doc.xpath("//div[@class='pricing condense']").text else total = doc.xpath("//div[@class='pricing ']").text end
我想知道无论如何我可以让机械化自动获取包含字符串“定价”的div吗?
是doc一个Mechanize::Page?通常约定是page针对那些和doc针对Nokogiri::HTML::Document. 无论如何,对于任何一个尝试:
doc
Mechanize::Page
page
Nokogiri::HTML::Document
doc.search('div.pricing')
对于第一个,使用at代替search:
at
search
doc.at('div.pricing')