公告:魔扣目录网为广大站长提供免费收录网站服务,提交前请做好本站友链:【 网站目录:https://www.morko.net 】, 免友链快审服务(50元/站),

点击这里在线咨询客服
新站提交
  • 网站:51998
  • 待审:31
  • 小程序:12
  • 文章:1030137
  • 会员:747

本文介绍了获取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错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,

分享到:
标签:appium common exceptions IO uiautomator2 获取 错误
用户无头像

网友整理

注册时间:

网站:5 个   小程序:0 个  文章:12 篇

  • 51998

    网站

  • 12

    小程序

  • 1030137

    文章

  • 747

    会员

赶快注册账号,推广您的网站吧!
最新入驻小程序

数独大挑战2018-06-03

数独一种数学游戏,玩家需要根据9

答题星2018-06-03

您可以通过答题星轻松地创建试卷

全阶人生考试2018-06-03

各种考试题,题库,初中,高中,大学四六

运动步数有氧达人2018-06-03

记录运动步数,积累氧气值。还可偷

每日养生app2018-06-03

每日养生,天天健康

体育训练成绩评定2018-06-03

通用课目体育训练成绩评定