io.magentys.cinnamon.webdriver.elements.SelectedCondition Maven / Gradle / Ivy
package io.magentys.cinnamon.webdriver.elements;
import io.magentys.cinnamon.webdriver.conditions.Condition;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
public class SelectedCondition extends Condition {
@Override
public boolean apply(final WebElement element) {
try {
return element.isSelected();
} catch (NullPointerException | WebDriverException e) {
return false;
}
}
@Override
public boolean equals(final Object o) {
return o == this || o instanceof SelectedCondition;
}
@Override
public int hashCode() {
return new HashCodeBuilder().toHashCode();
}
@Override
public String toString() {
return "selected";
}
}