My requirement is to check the quanity added to the cart matches to 1 in the Test class.
I have used the below xpath, but this throws 'NoSuchElementException'
Could you please help me locate the Element and later use the attribute value and verify if it matches to 1.
I have created a Page -
public class CartPage extends BasePage{
@FindBy(xpath="//tr/td[contains(.,\" Funny Cow\")]/td[3]/input/@value") //NoSuchElementException thrown for this line
public WebElement funnyCowCart;
@FindBy(xpath="//tr/td[contains(.,\" Fluffy Bunny\")]/td[3]/input/@value")
public WebElement fluffyBunnyCart;
@FindBy(xpath="//a[@href=\"#/checkout\"]")
public WebElement checkOut;
Later in the Test Class, I want to verify the quantity is 1.
String funnyCowQty = cart.funnyCowCart.getAttribute("value");
softAssert.assertTrue(funnyCowQty == "1","Funny Cow Quantity mismatch");