How can I print label associated with
<input type="checkbox" />, likecheckbox 1orcheckbox 2in example below.
Checkbox Items:
<input type="checkbox" value="cb1" name="checkboxes[]">Checkbox 1
<input type="checkbox" value="cb2" name="checkboxes[]">Checkbox 2
<input type="checkbox" checked="checked" value="cb3" name="checkboxes[]">Checkbox 3
I am using below code to get the label name , but it doesn't work.
getText() is also not working.
List<WebElement> elementList = driver.findElements(By.name("checkboxes[]"));
System.out.println("checkbox1? "+elementList.get(0).getAttribute("innerHTML"));`