Appium:所有元素在android 8中均不可点击,但在android 5中可正常使用

时间:2018-10-30 02:52:54

标签: java android appium android-8.0-oreo android-5.1.1-lollipop

在appium测试中,在单击android 8.0.0(三星银河S8)中的所有元素时会出现NoSuchElementException,但在Galaxy Note5-android 5.1.1中可以正常工作

    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("deviceName", "Galaxy S8");
    caps.setCapability("udid", udid); //Device ID of mobile phone
    caps.setCapability("platformName", "Android");
    caps.setCapability("platformVersion", "8.0.0");

    caps.setCapability("appPackage", appPackage);
    caps.setCapability("appActivity", appActivity);

    caps.setCapability("noResetValue", "false");

    caps.setCapability("autoGrantPermissions", true);       

    AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), caps);
    driver.runAppInBackground(Duration.ofSeconds(1));//Tried to refresh

    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

ApplicationTest.wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.id(“ com.starhub.itv:id/user_guide_btn”)))))。click(); //安装启动浏览器后,单击按钮< / p>

ApplicationTest.wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.id(“ com.starhub.itv:id/root_view”))))))。click(); //随机单击以跳过

0 个答案:

没有答案