Android 错误:类型不匹配:无法将findbyclassname的元素类型对象转换为WebElement
想在Android中编写一个处理弹出消息的通用函数:Android 错误:类型不匹配:无法将findbyclassname的元素类型对象转换为WebElement,android,appium,Android,Appium,想在Android中编写一个处理弹出消息的通用函数: public static WebElement andDismiss() { for(WebElement e : appiumDriver.findElementsByClassName("android.widget.Button")) { if(e.getAttribute("text").equals("No") || e.getAttribute("text").equals("Cancel
public static WebElement andDismiss() {
for(WebElement e : appiumDriver.findElementsByClassName("android.widget.Button")) {
if(e.getAttribute("text").equals("No") || e.getAttribute("text").equals("Cancel")) {
return e;
}
}
return null;
}
但我得到了以下错误:
类型不匹配:无法从元素类型对象转换为WebElement