By using getAttribute(value);
It returns the value of the attribute passed as a parameter.
HTML:
<input name="nameSelenium" value="valueSelenium">SoftwareTestingMaterial</input>
1
<input name="nameSelenium" value="valueSelenium">SoftwareTestingMaterial</input>
Selenium Code:
String attributeValue = driver.findElement(By.name("nameSelenium")).getAttribute("value");
System.out.println("Available attribute value is :"+attributeValue);
Output: valueSelenium
1
2
3
String attributeValue = driver.findElement(By.name("nameSelenium")).getAttribute("value");
System.out.println("Available attribute value is :"+attributeValue);
Output: valueSelenium