[英]Original error: io.appium.uiautomator2.common.exceptions.UiAutomator2Exception
[英]Getting io.appium.uiautomator2.common.exceptions.UiAutomator2Exception error
我为Android TV流应用程序编写了自动化程序,运行测试时遇到问题。 当我尝试运行test时,出现错误:
org.openqa.selenium.WebDriverException:处理命令时发生未知的服务器端错误。 原始错误:io.appium.uiautomator2.common.exceptions.UiAutomator2Exception:java.lang.IllegalArgumentException:尚未声明前缀为'com.onoapps.some.dev'的命名空间。
有人知道是什么问题吗?
我正在使用:
那就是我想做的。
public class RemoteControl extends AppiumBaseClass {
public RemoteControl(AppiumDriver driver) {
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
}
@AndroidFindBy(xpath = "//com.onoapps.some.dev:id/topRootId[@focusable='true']")
private MobileElement currentTab;
public String getCurrentTabName() {
MobileElement tabText = currentTab.findElement(By.id("com.onoapps.some.dev:id/topBarItemTextViewId"));
return tabText.getText();
}
}
public class SeriesScreenFlows extends BaseTestClass {
public void getSeriesTab(){
getCurrentTabName();
}
}
public class BaseTestClass extends AppiumBaseClass {
public WebDriverWait wait;
public Series_screen series_screen;
public RemoteControl remoteControl;
@Before
public void setUp() throws MalformedURLException {
AppiumController.instance.start();
series_screen = new Series_screen(driver());
remoteControl = new RemoteControl(driver());
}
}
通过ID查找MobileElement时,无需包含应用程序包,因此请更改以下行:
MobileElement tabText = currentTab.findElement(By.id("com.onoapps.some.dev:id/topBarItemTextViewId"));
对此
MobileElement tabText = currentTab.findElement(By.id("topBarItemTextViewId"));
并且您的测试应该按预期开始工作。
或者,如果您想使用XPath
MobileElement tabText = currentTab.findElement(By.xpath("//*[@id='com.onoapps.some.dev:id/topBarItemTextViewId']"));
详细信息: AS-运行现有的Appium测试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.