DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 600);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "ANDROID");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "SM-N950U1");
capabilities.setCapability(MobileCapabilityType.UDID, "ce09171918f21c6c0c7e");
capabilities.setCapability("launchTimeout", 90000);
capabilities.setCapability("appPackage", "com.pcloudy.appiumdemo");
capabilities.setCapability("appActivity", "com.ba.mobile.LaunchActivity");
URL url = new URL("http://127.0.0.1:4724/wd/hub/");
driver = new AndroidDriver<WebElement>(url, capabilities);
driver.findElement(By.xpath("//android.widget.Button[@resource-id='com.pcloudy.appiumdemo:id/accept' and @text='Accept']")).click();
Error is occuring at the line'driver = new AndroidDriver<>' as
Mar 23, 2022 5:29:41 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end Mar 23, 2022 5:29:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS FAILED: Test1 java.lang.NullPointerException: null value in entry: lastScrollData=null
But the app is opened in the device, but failed to click the button after instantiating the driver.