0

这是我的代码

       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");

它会在我的 Galaxy 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 的新手。谢谢

4

2 回答 2

0

问题出在 Selenium 版本2.42.2中,更改为2.42.0并且它应该可以工作

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

于 2014-07-25T10:53:34.047 回答
0

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

于 2014-06-23T14:28:53.513 回答