I am using Selenium in Java to test the checking of a checkbox in a web-app. Here's the code:
private boolean isChecked;
private WebElement e;
I declare e and assign it to the area where the checkbox is
isChecked = e.findElement(By.tagName("input")).getAttribute("checked").equals("true");
What is weird is that getAttribute("checked") returns null and therefore a NullPointerException
In the HTML for the checkbox, there is no checked attribute displayed. However, isn't it the case that all input elements have a checked = "true" so this code should work?