我已经阅读了所有我能找到的东西,尝试了所有这一切,我仍然坚持这件事。因此,在混合应用程序上工作时,它具有登陆屏幕(完全原生),并带有一个打开webview的按钮。在我切换到Web视图以尝试定位元素后,appium制动。有没有人有类似的问题?或者任何建议或解决方案?
以下是相关代码:
public void randomTest() throws InterruptedException{
driver.findElement(By.id("com.something.something:id/activate")).click(); //This is native part
Thread.sleep(3000);
driver.context("WEBVIEW_com.something.something"); //here it brakes (and NOT EVERY time, sometimes it passes this point, but lets say once in 10 times it passes..)
Thread.sleep(100);
//Assert.assertTrue(driver.findElement(By.className("button")).isDisplayed());
}
Appium报告设备不可见(adb仍然可以看到它) Appium报道了这个(以及其他内容):
Available contexts:
[debug] ["WEBVIEW_com.something.something","WEBVIEW_com.something.something"
[debug] Available contexts:
NATIVE_APP,WEBVIEW_com.something.something,WEBVIEW_com.something.something
[debug] Connecting to chrome-backed webview
value: { message: 'unknown error: Device KR7A3P92LS is not online\n (Driver info: chromedriver=2.18.343845.......
然后在其他一些东西之后说:
Error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device KR7A3P92LS is not online
帮助? :)
答案 0 :(得分:0)
原因:当chromedriver在切换到webview或从webview切换时无法访问时会发生这种情况,appium会继续等待来自chromedriver的响应。
解决方案:监视chromedriver,在它挂起时终止/重新启动它。
详细解答:Appium (v1.4.16.1), Switch to WebView fails when i try a second time