I am trying to locate specific text inside some elements on a HTML page.
<a class="ProductCard-link ProductCard-content" target="_self" tabindex="0" href="/en/product/puma-future-rider-menshoes/314207160004.html">
<span class="ProductName">
<span class="ProductName-primary">
Puma Future Rider
</span>
<span class="ProductName-alt">
Men Shoes
<span class="ProductName-separator">•</span>
Black-White-Red
</span>
</span>
</a>
I am trying to locate this text inside the elements: "Black-White-Red"
I can locate the name of the shoe with this XPath: //[@id='main']/div/div[2]/div/section/div/div[2]/ul[1]/li/div/a/span[1]/span[@class='ProductName-primary'][contains(text(), 'Puma Future Rider')]
However I just cant seem to find any valid XPath to locate the color of the shoe, I've tried this one:
//*[@id='main']/div/div[2]/div/section/div/div[2]/ul[1]/li/div/a/span[1]/span[@class='ProductName-alt'][contains(text(), 'Black-White-Red')]
Which I expected to work, it does NOT. It is weird because I can find the "Men Shoes" text, but not the color which is in the same tag:
//*[@id='main']/div/div[2]/div/section/div/div[2]/ul[1]/li/div/a/span[1]/span[@class='ProductName-alt'][contains(text(), 'Men Shoes')]
Thank you all in advance, hope you can help me solve this! :)