Я пробовал следующие локаторы
driver.findElement(By.xpath("//android.widget.ImageButton[@content-desc='Open navigation drawer']")).click();
or
driver.findElement(By.xpath("//android.widget.ImageButton[@index='0'])")).click();
or
driver.findElementByXPath("(//android.view.ViewGroup)[1]").click();
Загрузка = Ссылка
Невозможно нажать на изображениекнопка.
@Test
public AndroidDriver<AndroidElement> Loging() throws MalformedURLException, InterruptedException {
File file = new File("src/test/java", "opentap-v1.1-28012019.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Pixel_C_Edited_API_28");
capabilities.setCapability(MobileCapabilityType.APP, file.getAbsolutePath());
AndroidDriver<AndroidElement> driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"),
capabilities);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.findElement(By.id("com.opentap:id/btn_go")).click();
driver.findElement(By.id("username")).clear();
driver.findElement(By.id("username")).sendKeys("kaustubh.patil");
driver.findElement(By.id("password")).clear();
driver.findElement(By.id("password")).sendKeys("opentapuat");
driver.findElement(By.id("rememberMe")).click();
driver.findElement(By.id("kc-login")).click();
// driver.findElement(By.id("com.opentap:id/btn_go")).click();
// Thread.sleep(10000);
// driver.findElement(By.xpath("//android.widget.ImageButton[@index='0'])")).click();
// driver.findElementByXPath("(//android.view.ViewGroup)[1]").click();
// WebDriverWait wait = new WebDriverWait(driver, 25);
// WebElement element =
// wait.until(ExpectedConditions.elementToBeClickable(By.id("com.opentap:id/add")));
/*
* try { Thread.sleep(1000); WebDriverWait wait = new WebDriverWait(driver, 30);
* wait.until(driver .findElement(By.
* xpath("//android.widget.ImageButton[@content-desc='Open navigation drawer']")
* )); } catch (Throwable error) {
* Assert.fail("Timeout waiting for Page Load Request to complete."); }
*/
driver.manage().timeouts().setScriptTimeout(25, TimeUnit.SECONDS);
driver.findElement(By.xpath("//android.widget.ImageButton[@content-desc='Open navigation drawer']")).click();
return driver;
}