im trying to check that the selected product matches the product on the shopping cart (by the product name or the product price), but the problem is that the way the labels appears is not standardized, so sometimes the product name can have different labels above and below. Also, products may have different name and price each time.
To find a way to match both elements using XPath of normal testRigor locators
In this scenario case grab value functionality can help you achieve the validation. Since the product names and prices are dynamic, you could reference the element by location and the compare it:
grab value from first element to the left of "Subtotal" and below "Shopping cart" and save it as "cartSubtotal"
After you could close the cart pop-up, and use:
check that page contains stored value "cartSubtotal"