SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

AndroidWebDriver times out and does not allow for changing timeout values #6302

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 6302

I'm trying to use the AndroidDriver with the WebDriver APK. My problem is that the call
to driver.get() seems to time-out after 20 seconds. Trying to set the error, I encountered
an UnsupportedOperationException exception. I traced it to AndroidWebDriver.java:1170:

public Timeouts pageLoadTimeout(long time, TimeUnit unit) {
  throw new UnsupportedOperationException("pageLoadTimeout");
}

Why is this feature not supported? Is there any way to change (or disable) the time-out?

What steps will reproduce the problem?
1. Follow the instructions on <http://code.google.com/p/selenium/wiki/AndroidDriver>
2. Look up a heavy enough URL for 20 seconds to pass (in my environment, most URL:s
will take over 20 seconds to load)

What is the expected output? What do you see instead?
I expected the time-out to be longer than 20 seconds, and the get() call to finish
normally. Instead, I get the following exception:

FAILED CONFIGURATION: @BeforeTest setBaseURL
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the
remote browser. It may have died.
Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.8.0-30-generic', java.version:
'1.7.0_25'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276)
    at com.test.NewTest.setBaseURL(NewTest.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
    at org.testng.TestRunner.beforeRun(TestRunner.java:641)
    at org.testng.TestRunner.run(TestRunner.java:609)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: org.apache.http.NoHttpResponseException: The target server failed to respond
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:95)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
    at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:712)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:517)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:337)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:298)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
    ... 24 more

SKIPPED CONFIGURATION: @AfterTest sendSession

Selenium version: 2.35
OS: Ubuntu (64-bit)
Browser: Android APK
Browser version: 2.32

Thanks in advance!

Reported by info@jonkri.com on 2013-09-20 20:58:51

lukeis commented 8 years ago

Reported by barancev on 2013-09-25 12:07:41

lukeis commented 8 years ago
I have since this issue was created realized that even though the NoHttpResponseException
is thrown, the actual use of the driver object (such as findElement) still works. It
would be nice not to have to catch and ignore the exception, though (so that other
UnreachableBrowserExceptions can be caught and acted upon appropriately). :-)

Thanks for labeling this issue, barancev.

Reported by info@jonkri.com on 2013-09-25 13:44:37

lukeis commented 8 years ago
Selenium project no longer supports the AndroidDriver.

Please use Selendroid instead:
http://selendroid.io/webview.html

And log any issues against that project:
https://github.com/selendroid/selendroid/issues

Reported by luke.semerau on 2013-12-26 21:57:36

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 18:18:00