我正在尝试匹配网站中的元描述,但无法获取过去的 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