Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Apr 10, 2018 02:13

Problem

Recently the Appium isSelected method has become deprecated and no longer works.

Solution

As a workaround, use the method below to find if an element is selected:


List<WebElement> elements = driver.findElementsByXPath("//XCUIElementTypeSwitch");
if (elements.size() > 0) {
	WebElement theObject = elements.get(0);
	boolean isSelected = ("1".equals(theObject.getAttribute("value")));
}