In my code, I need to verify that the text "Product successfully added to your shopping cart" is displayed after adding an item to cart. Here is the screenshot, and also the element. As we can see, the text does not have a tag, i.e something like text="Product Added to your shopping cart". Its like just floating there on its own.
Here is the full xpath of this text object : //*[@id="layer_cart"]/div[1]/div[1]/h2/text()
If I try to use this full path, I'm getting an error "object is text, it should be an element".
If I try to use until "[@id="layer_cart"]/div[1]/div[1]/h2"
, and dont include the 'text()'
, I cannot get the text and verify, because its really not part of the <i>
tag. The result is just blank text. Any ideas? thanks