Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I write automation for Android TV streaming app, I have problem to run the test. When I'm trying to run test , i got error:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: io.appium.uiautomator2.common.exceptions.UiAutomator2Exception: java.lang.IllegalArgumentException: Namespace with prefix 'com.onoapps.some.dev' has not been declared.

Anyone know what the problem is?

I'm using:

  • Xiaomi miBox.
  • Appium
  • JUnit
  • That's what I was trying to do.

            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());
    

    You don't need to include you app package when you locate a MobileElement by ID so change this line:

    MobileElement tabText = currentTab.findElement(By.id("com.onoapps.some.dev:id/topBarItemTextViewId"));
    

    to this

    MobileElement tabText = currentTab.findElement(By.id("topBarItemTextViewId"));
    

    and your test should start working as expected.

    Alternatively if you want to use XPath

    MobileElement tabText = currentTab.findElement(By.xpath("//*[@id='com.onoapps.some.dev:id/topBarItemTextViewId']"));
    

    More information: AS - Run your existing Appium tests

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.