How to get attribute value of an element with Java-Cucumber?

how to get attribute value of an element with Java-Cucumber?

Hello Jacqueline-bosco,

You can getAttribute(). The getAttribute() method of the Element interface returns the value of a specified attribute on the element.

Example:

//Fetching the placeholder value
                  WebElement emailField = driver.findElement(By.id("address"));
                  String placeholderVal = emailField.getAttribute("placeholder");
                  String expectedVal = "your@email.com";