Appium+java检查checkbox是否被选中
如何判断CheckBox是否选中,我们发现这个值checked勾选为false 未勾选为true,使用.getAttribute函数获取checked值,需要注意checked值是String类型需要转换为boolean类型。
//获取checkbox的属性checked值
String t1 = driver.findElementById(“com.wiwj.xiangyucustomer:id/cb_protocol”).getAttribute(“checked”);
//String转换为Boolean
boolean z= Boolean.parseBoolean(t1);