【问题标题】:Feature not implemented error message in appium在 appium 中未实现功能的错误消息
【发布时间】:2017-07-17 09:49:06
【问题描述】:

在 Appium 中收到错误消息“未实现功能”...请帮助!

公共类登录{

DesiredCapabilities 上限; AndroidDriver驱动;

@BeforeTest
public void test() throws MalformedURLException, WebDriverException, InterruptedException  {

    File appdir= new File("src");
    File app= new File(appdir, "ECare.apk");

    caps= new DesiredCapabilities();
    caps.setCapability(MobileCapabilityType.PLATFORM_NAME,Platform.ANDROID);
    caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
    caps.setCapability(MobileCapabilityType.APPIUM_VERSION, "1.4.16.1");
    caps.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
    //caps.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 300000);
    caps.setCapability(MobileCapabilityType.HAS_TOUCHSCREEN, "True");
    driver=new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps);
    driver.manage().timeouts().implicitlyWait(9, TimeUnit.SECONDS);
}


@Test
public void okOnAlert() throws InterruptedException
{
    WebDriverWait wait= new WebDriverWait(driver, 2);
    wait.until(ExpectedConditions.alertIsPresent());
    Alert alert= driver.switchTo().alert();
    driver.findElementById("com.android.packageinstaller:id/dialog_container").getText();
    Thread.sleep(3000);
    alert.accept();
}

@AfterTest
public void End()
{
    driver.quit();
}

} Trying to click on allow button but unable to click :(

【问题讨论】:

  • 查看整个错误输出并了解问题发生的上下文会很有帮助。

标签: selenium-webdriver appium


【解决方案1】:
driver.switchTo().alert(); is not for mobile applications. You have to find Xpath of button which you want to click and perform click operation on that. For Example :

@findBy(id="android:/button1")
public WebElement ok;

// once you identified your element , click on the desired button.

ok.Click()

【讨论】:

  • 请花一点时间将答案中的代码格式化为代码。
  • 非常感谢...我知道我哪里出错了...感谢您的帮助! :)
猜你喜欢
  • 2012-02-11
  • 1970-01-01
  • 2014-01-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多