Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
RemoteWebDriver+;AndroidDriver:与浏览器通信时出错_Android_Selenium_Android Emulator_Webdriver_Selenium Webdriver - Fatal编程技术网

RemoteWebDriver+;AndroidDriver:与浏览器通信时出错

RemoteWebDriver+;AndroidDriver:与浏览器通信时出错,android,selenium,android-emulator,webdriver,selenium-webdriver,Android,Selenium,Android Emulator,Webdriver,Selenium Webdriver,我最近开始使用->RemoteWebDriver+AndroidDriver。我从一个基本示例开始,如下所示: stmt1:WebDriver driver=new AndroidDriver(); stmt2:driver.get("http://www.google.com"); stmt3:WebElement element = driver.findElement(By.name("q")); stmt4:element.sendKeys("Cheese!"); “stmt1

我最近开始使用->RemoteWebDriver+AndroidDriver。我从一个基本示例开始,如下所示:

 stmt1:WebDriver driver=new AndroidDriver();
 stmt2:driver.get("http://www.google.com");
 stmt3:WebElement element = driver.findElement(By.name("q"));
 stmt4:element.sendKeys("Cheese!");
“stmt1”、“stmt2”在模拟器上成功打开google.com。 问题是“stmt3”和“stmt4”不起作用。Emulator关闭webdriver,并在eclipse中生成以下异常:

org.openqa.selenium.WebDriverException: Error communicating with the remote browser. It may have died.
Build info: version: '2.12.0', revision: '14666', time: '2011-11-10 18:36:18'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_33'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:412)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:205)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:254)
    at org.openqa.selenium.By$ByName.findElement(By.java:286)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:197)
    at androidpackage.Androidclass$1.apply(Androidclass.java:24)
    at androidpackage.Androidclass$1.apply(Androidclass.java:1)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:189)
    at androidpackage.Androidclass.testAndroid(Androidclass.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.http.NoHttpResponseException: The target server failed to respond
    at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:101)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247)
    at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:298)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:645)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
    at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:391)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:370)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:398)
    ... 27 more

从stacktrace来看,您的selenium版本似乎是2.12.0。当前版本为。也许使用最新版本可以解决这个问题。

问题是我使用了android 2.3.3(姜饼上的bug可能导致WebDriver崩溃)。在升级到android 4.0.3时,代码运行良好。

很好,您可以看到在2.12和2.25之间有与android相关的更改。阅读变更日志。这不是使用2.24的问题,我会得到相同的错误日志