没有 children 的 Nokogiri css 文本选择器
Nokogiri ccs text selector without children
我有以下 html 代码,我需要使用 Nokogiri css 选择器从中提取 194.99 欧元,但我无法得到我需要的东西。
<p class="price price-offer price-len5">
<span class="border">
<span class="price-old">€219,99</span>
€194,99
</span>
</p>
我试过这些选择器,但没有成功:
product.css('.price span:not(.price span span)').text
product.css('.price:not(.price-old)').text
你们有什么想法吗?
谢谢
那就是:
product.at('.price-old').next.text
或
product.at('.price .border').children[-1].text
我有以下 html 代码,我需要使用 Nokogiri css 选择器从中提取 194.99 欧元,但我无法得到我需要的东西。
<p class="price price-offer price-len5">
<span class="border">
<span class="price-old">€219,99</span>
€194,99
</span>
</p>
我试过这些选择器,但没有成功:
product.css('.price span:not(.price span span)').text
product.css('.price:not(.price-old)').text
你们有什么想法吗?
谢谢
那就是:
product.at('.price-old').next.text
或
product.at('.price .border').children[-1].text