Hi all,
I am writing a Java script to verify if a checkbox is 'checked' on an Android view.
So on the view, I got a list of WebElements with tagName CheckBox. Then I try to verify if the first checkbox (the only one) is 'checked'.
List<WebElement> checkboxes = driver.findElements(By.tagName("CheckBox"));
if (checkboxes.get(0).isSelected()) {
my code
}
But I got the following error:
org.openqa.selenium.WebDriverException: Returned value cannot be converted to Boolean: false
I googled the above error message and found the isSelected method:
public boolean isSelected() {
|
Object value = execute(DriverCommand.IS_ELEMENT_SELECTED, ImmutableMap.of("id", id))
|
.getValue();
|
try {
|
return (Boolean) value;
|
} catch (ClassCastException ex) {
|
throw new WebDriverException("Returned value cannot be converted to Boolean: " + value, ex);
|
}
|
} So, basically there is a ClassCastException when WebDriver was trying to convert the returned value to Boolean? Do you know what I should do to correct this? Thanks. |