我试图匹配网站中的元描述,但无法取得过去的HTML实体。我试过逃脱角色和其他一些组合。如果您尝试在没有实体的情况下匹配文本的某个区域,则不存在任何问题。任何帮助apprecaited。Watir/Ruby HTML实体
require "rubygems"
require "watir-webdriver"
include Watir
b = Watir::Browser.new :chrome
b.goto('http://dev01-new.firestonecompleteautocare.com/cf/oil-change/motor-oil-and-your-car')
if b.metas.any?{ |s| s.html.include? "Ever wonder what color your engine oil should
be, or what affect temperature may have on it? Learn the answers to these
frequently asked questions & more, here." }
puts 'Yes'
else
puts 'No'
end
b.close
不要做'''包含Watir''''。这不是必需的,只会污染物体空间。 – 2013-02-10 14:57:04