Appium(v1.4.16.1),当我尝试第二次切换到的WebView失败 [英] Appium (v1.4.16.1), Switch to WebView fails when i try a second time

查看:1730
本文介绍了Appium(v1.4.16.1),当我尝试第二次切换到的WebView失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Appium(v1.4.16.1),当我尝试切换到的WebView第二次切换到的WebView失败。有什么事我应该考虑?

请参阅在Android上使用Appium下面的用例 -


  1. 启动Android设备>执行一些动作

  2. 上下文切换= WebView_1>执行一些动作

  3. 上下文切换= Native_App

  4. 上下文切换= WebView_1>执行一些动作

在步骤#2和步骤#4中,它是相同WebView_1,但内容是不同的。你说:第2步打开HTML-1和步骤#4中打开HTML-2

问题:我不能切换上下文步骤#4。


  

下面....是错误的一些日志


  
  

    

信息:[调试]可用的上下文:NATIVE_APP,WEBVIEW_1
    信息:[调试]连接到镀铬支持的WebView
    信息:[调试]响应客户端的错误:{身份:13,价值:{消息:在处理命令时,未知的服务器端错误(原来的错误:我们已经有一个chromedriver实例运行),origValue:我们已经有一个运行实例chromedriver},的sessionId:38904ff5-928a-4dc0-AC8A-c7bc5f6504e4}


  

解决方案

切换到网页视图,然后native_app导致问题sproadically在appium,我有同样的问题和研究后,我发现,在切换到网页视图,chromedriver有时,变得没有反应,直到超时appium定义,因此出现这些问题,如何解决这一问题的chromedriver appium等待:
创建一个线程来监视chromedriver,当它挂起,重新启动chromedriver。

现成的解决方案:从 https://github.com/mi2pankaj/chromeDriverHandler 下载chromedriverhandler.jar,添加到项目中,

在beforeTest / beforeClass或测试开始使用这样的:
ChromedriverHandler.chromeDriverHandlerThread()开始();

在afterTest /课余或您的测试结束时使用此:
ChromedriverHandler.chromeDriverHandlerThread()停止();

请注意:你可能需要把这些东西加到你的项目:Apache的HttpClient的-4.3.1.jar,的HttpCore-4.3.jar和JSON简单的jar:JSON-20080701.jar

希望这有助于。

Appium (v1.4.16.1), Switch to WebView fails when I try to switch to webview second time. Is there something I should be considering?

Please refer to the below use case using Appium on Android-

  1. Launch Android Device > Perform some actions
  2. Switch context = WebView_1 > Perform some actions
  3. Switch context = Native_App
  4. Switch context = WebView_1 > Perform some actions

In Step#2 and Step#4, it is the same WebView_1, but the content is different. Say: step#2 opened html-1 and step#4 opened html-2.

Problem: I am unable to switch context in Step#4.

.... below are some logs of the error

info: [debug] Available contexts: NATIVE_APP,WEBVIEW_1 info: [debug] Connecting to chrome-backed webview info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: We already have a chromedriver instance running)","origValue":"We already have a chromedriver instance running"},"sessionId":"38904ff5-928a-4dc0-ac8a-c7bc5f6504e4"}

解决方案

switching to webview and then to native_app causes problem sproadically in appium, I had the same problem and after researching I found out that on switching to webview, chromedriver sometimes, becomes unresponsive and appium waits for chromedriver until the timeout defined for appium and thus these problem occurs, how to fix this: Create a thread to monitor chromedriver, when it hangs, restarts chromedriver.

Readymade solution: Download chromedriverhandler.jar from https://github.com/mi2pankaj/chromeDriverHandler, add to your project,

use this in beforeTest/beforeClass or at the start of your test: ChromedriverHandler.chromeDriverHandlerThread().start();

use this in afterTest/afterClass or at the end of your test: ChromedriverHandler.chromeDriverHandlerThread().stop();

Note: you may need to add these to your project: apache's httpclient-4.3.1.jar, httpcore-4.3.jar and json simple jar: json-20080701.jar

Hope this helps.

这篇关于Appium(v1.4.16.1),当我尝试第二次切换到的WebView失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆