A web element is clicked but no action is performed (Android)

Asked

Viewed 25 times

1

sorry for the language, but so I’ll be more direct

I’m having a problem, I find the (mobile) element in a real device, point to it and click, but always returns the error message java.lang.Nullpointerexception', can anyone help me? Code below

public class testCalculator {
    @Test
    public void teste() throws MalformedURLException{
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "DACEE6CE5DCEEQEI");
        capabilities.setCapability("appPackage","com.calculator");
        capabilities.setCapability("appActivity", "com.calculator.Calculator");
        capabilities.setCapability("autoGrantPermissions", "true");
        AndroidDriver<?> driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
        driver.context("NATIVE_APP");
        driver.findElement(By.id("com.calculator:id/tips_btn")).click();
        //driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"com.tct.calculator:id/tips_btn\").instance(0)")).click();
        driver.quit();
    }
}
  • Can you tell which line is giving the Exception?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.