与Selendroind合作得到错误

时间:2014-06-20 19:12:34

标签: android selenium selendroid

这是我的代码

       SelendroidCapabilities capa = new SelendroidCapabilities("io.selendroid.testapp:0.10.0");

    System.out.println("start");
    WebDriver driver = new SelendroidDriver(capa);
    //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    System.out.println("open the app");
    WebElement inputField = driver.findElement(By.id("my_text_field"));
    //Assert.assertEquals("true", inputField.getAttribute("enabled"));

    inputField.sendKeys("Hello, selenium");

    System.out.println("close app");

它在我的星系S4上打开应用程序,然后生成以下错误。

selendroid-standalone server has been started on port: 4444
start
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30'
System info: host: 'VAIO', ip: '192.168.1.4', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_13'
Driver info: driver.version: SelendroidDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
    at io.selendroid.SelendroidDriver.<init>(SelendroidDriver.java:70)
    at mymob.Navitve_S4.main(Navitve_S4.java:42)
Caused by: org.apache.http.client.ClientProtocolException
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:188)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
    at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:204)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:173)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
    ... 5 more
Caused by: org.apache.http.HttpException: Unsupported Content-Coding: none
    at org.apache.http.client.protocol.ResponseContentEncoding.process(ResponseContentEncoding.java:98)
    at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:139)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:200)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
    ... 10 more

真的很感激您是否可以提供帮助,以解决此错误。我是selendroind的新手。 感谢

2 个答案:

答案 0 :(得分:0)

如果您使用selendroid 0.10.0,请检查是否使用-app atrubute启动selendroid-standalone(-aut in 0.9.0)。

答案 1 :(得分:0)

问题在于Selenium版本 2.42.2 ,更改为 2.42.0 ,它应该可以使用

https://github.com/selendroid/selendroid/issues/466