SeleniumHQ / selenium-google-code-issue-archive

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

Python Android driver.get exception thrown #2359

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 2359

After starting a new android emulator, and binding my driver, when i try to navigate
to a webpage, i get the following exception.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.5.0-py2.7.egg/selenium/webdriver/remote/webdriver.py",
line 154, in get
    self.execute(Command.GET, {'url': url})
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.5.0-py2.7.egg/selenium/webdriver/remote/webdriver.py",
line 144, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.5.0-py2.7.egg/selenium/webdriver/remote/errorhandler.py",
line 118, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: None ; Stacktrace: Method handle
threw an error in WebDriverHandler.java 

Details:
Python 2.7.2
SE 2.5

Steps:
from selenium import webdriver
driver = webdriver.Remote(desired_capabilities="ANDROID", command_executor='http://localhost:8080/wd/hub')
driver.get('http://www.google.com')
--insert exception here

however, using the driver.get command on an iphone emulator works without error.

Reported by JeffreyRBarnes on 2011-08-29 17:01:06

lukeis commented 8 years ago

Reported by barancev on 2011-10-13 08:35:52

lukeis commented 8 years ago

Reported by berrada@google.com on 2011-10-21 04:25:31

lukeis commented 8 years ago
I have experienced this problem as well. Looking at the html content returned from the
get request, the exact Java exception is:

<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /wd/hub/session. Reason:
<pre>    java.lang.String cannot be cast to java.util.Map</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>

Reported by jonathan.wylie on 2011-11-16 15:27:47

lukeis commented 8 years ago
Ok so the problem is not coming from the driver.get command but actually it is the initializing
of the driver itself.
It seems that it is expecting a map instance (as indicated by the exception) for the
desired_capabilities option, if you pass desired_capabilities={}, then it should work.
At least it worked for me.

Reported by jonathan.wylie on 2011-11-16 16:34:48

lukeis commented 8 years ago
If you do 

from selenium import webdriver

android = webdriver.Remote(command_executor='http://localhost:8080/wd/hub', desired_capabilities=webdriver.DesiredCapabilities.ANDROID)
android.get("http://foo.bar") 

it will work.

Reported by david.burns@theautomatedtester.co.uk on 2011-11-16 16:43:25

lukeis commented 8 years ago

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