Reputation: 39
I try to check containing "span iteamprop" in div with class = f6 color-text-secondary mt-2 using the following command, but it doesn't work:
$paragraphs = $doc.DocumentNode.SelectNodes("//div[@class='f6 color-text-secondary mt-2' and contains(//span[@itemprop])")[$i].Select()
if ($paragraphs) {
$language = $doc.SelectNodes("//span[@class='d-inline-block ml-0 mr-3']//span[@itemprop]")[$i].InnerText
}else{
$language = $null
}
Upvotes: 0
Views: 216
Reputation: 33371
Looks like you are missing the closing ]
of the element node and it should not be contains
since child element is not an attribute of the parent element. Also it should be a dot .
there.
Instead
"//div[@class='f6 color-text-secondary mt-2' and contains(//span[@itemprop])"
Try
"//div[@class='f6 color-text-secondary mt-2' and (.//span[@itemprop])]"
Upvotes: 1