Getting io.appium.uiautomator2.common.exceptions.UiAutomator2Exception error(获取io.appium.uiautomator2.common.exceptions.UiAutomator2Exception错误)
问题描述
我为Android电视流媒体应用程序编写自动化程序,运行测试时遇到问题。当我尝试运行测试时,出现错误:
Org.Openqa.selenium.WebDriverException:处理命令时出现未知的服务器端错误。原始错误:com.onoapps.ome.dev前缀为io.appium.uiautomator2.common.exceptions.UiAutomator2Exception:的命名空间尚未声明。
有人知道问题出在哪里吗?
我正在使用:
- 小米MiBox。
- Java
- Appium
- JUnit
这就是我想要做的。
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());
}
}
推荐答案
当您找到MobileElementID时,您不需要包括应用程序包,因此请更改此行:
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 - Run your existing Appium tests
这篇关于获取io.appium.uiautomator2.common.exceptions.UiAutomator2Exception错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:获取io.appium.uiautomator2.common.exceptions.UiAutomator2Exception错误


基础教程推荐
- RabbitMQ:消息保持“未确认"; 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13