I am using this xpath
//*[@class="relative mr3"]//div[2]//img/alt/text()
to extract
"Tramontina Primaware 18 Piece Non-stick Cookware Set, Steel Gray"
however I am getting empty excel cell.
I am using this xpath
//*[@class="relative mr3"]//div[2]//img/alt/text()
to extract
"Tramontina Primaware 18 Piece Non-stick Cookware Set, Steel Gray"
however I am getting empty excel cell.
2
Answers
I’m having some difficulty reading your code because of a poor colour scheme, but my suspicion is that you’ve fallen into the common trap of thinking that "//div[2]" means "the second descendant div" whereas it actually means "every descendant div that is the second div child of its parent".
The value of a attribute
alt
is not found withimg/alt/text()
but just withimg/@alt
Try this XPath: