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
とにかく、文字列「pricing」を含む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')