Selenium webdriver appium中未实现功能的错误消息
正在应用程序中获取错误消息“未实现功能”。。。请帮忙 公共类登录{ 期望的能力上限; 机器人驱动Selenium webdriver appium中未实现功能的错误消息,selenium-webdriver,appium,Selenium Webdriver,Appium,正在应用程序中获取错误消息“未实现功能”。。。请帮忙 公共类登录{ 期望的能力上限; 机器人驱动 @BeforeTest public void test() throws MalformedURLException, WebDriverException, InterruptedException { File appdir= new File("src"); File app= new File(appdir, "ECare.apk"); caps= new D
@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();
}
}
查看整个错误输出并获得问题发生在哪个上下文中的更多信息将很有帮助。查看整个错误输出并获得问题发生在哪个上下文中的更多信息将很有帮助。请花几分钟时间将答案中的代码格式化为代码。非常感谢。。。我知道我错在哪里了。。谢谢你的帮助!:)请花一分钟将答案中的代码格式化为代码。非常感谢。。。我知道我错在哪里了。。谢谢你的帮助!:)
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()