<a class="product-name" href="http:xyz" title="Polac pineapple slices 3kg">Polac pineapple slices 3kg</a>
<div class="price-box">
<span class="regular-price" id="product-price-5489">
<span class="price">Rs 665</span> </span>
我想从 Span 标签中获取价格,但它应该在匹配时提供特定商品的价格。就像如果标签的内部文本为 Polac pineapple 那么它应该返回 665 卢比以下是我正在使用的代码
`
var aTags = document.DocumentNode.SelectNodes("//a");
var nextTags = document.DocumentNode.SelectNodes("//span");
if (aTags != null)
{
foreach (var aTag in aTags)
{
s += counter + ". " + aTag.InnerText + "<br>";
//s += aTag.InnerText;
if (aTag.InnerText == "Polac pineapple")
{
brandcheck = true;
find += aTag.InnerText + " ";
foreach (var nextTag in nextTags)
{
//s += counter + ". " + nextTag.InnerText + "<br>";
s += nextTag.InnerText;
if (nextTag.InnerText.Contains("Rs"))
{
brandcheck = true;
find = nextTag.InnerText + " ";
}
}`