目前我遇到的问题是Appium驱动程序没有等待混合应用程序上的元素。它没有等待就超时了。下面是代码片段。我切换到webview。点击我有一个帐户按钮,并尝试将密钥发送到登录框。
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "/src/testdata/");
File app = new File(appDir, "CordovaApp-debug.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device", "Android");
capabilities.setCapability("deviceName","Motox");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.testing.Testing");
capabilities.setCapability("appActivity", "CordovaApp");
driver=new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
driver.manage().timeouts().implicitlyWait(60,TimeUnit.SECONDS);
@Test
public void ChangingLanguage() throws InterruptedException {
for (int i = 0; i < 20; i++) {
String nr = driver.getContextHandles().toString();
if (nr.contains("WEBVIEW")) {
driver.context("WEBVIEW_com.testing.Testing");
break;
}
else
{Thread.sleep(5000);}}
PageObjects.WelcomeView.HaveanAccount(driver).click();
Login.EmailBox(driver).sendKeys("madis@testing.com");
下面是错误消息:
org.openqa.selenium.NoSuchElementException:没有这样的元素 (会话信息:webview =) (驱动程序信息:chromedriver = 2.15.322448(52179c1b310fec1797c81ea9a20326839860b7d3),platform = Windows NT 6.1 SP1 x86_64)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:296毫秒