I have below html, how can i get the chechbox names?
<html>
<body>
<form>
<input type="checkbox" name="Countries" value="US">Unites States</input>
<input type="checkbox" name="Countries" value="UK">United Kingdom</input>
</form>
</body>
</html>
I tried below, but none helps:
List<WebElement> eles=driver.findElements(By.name("Countries"));
Integer ddSize=eles.size();
for(Integer i=0;i<ddSize;i++)
System.out.println(eles.get(i).getText());
or
for(WebElement ele:eles)
System.out.println(ele.getText());
also tried ele.getAttribute("text") etc...