androidselenium-webdriverappiumuiautomatorviewer

Unable to click on a button due to incorrect position in UI Automatorviewer


UI Automator Viewer

Whenever I use below command to click on Ok button, it clicks on the same position as pointing in UI Automator viewer. (screenshot)

I need to click on Ok Button.

Driver.findElement(By.xpath("//android.widget.Button[@text='Ok']")).click();

Solution

  • The problem was when i am trying enter data on signup page Keyboards opens and due to that UI Automator screenshot giving wrong position of button. So what i have done is to use below command to hide the keyboard before clicking signup button.

    Driver.navigate().back();
    delay(3000);
    Driver.findElement(By.id("btn_register_signup")).click();