I'm trying to use the HTMLUnit WebDriver from Python with the following code:
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote.webdriver import WebDriver
if __name__ == '__main__':
webdriver = WebDriver('http://127.0.0.1:4444/wd/hub', DesiredCapabilities.HTMLUNIT)
webdriver.get('http://www.google.com')
... and get the following error:
Traceback (most recent call last):
File "bcc_mon_webdriver.py", line 8, in <module>
webdriver = WebDriver('http://127.0.0.1:4444/wd/hub', DesiredCapabilities.HTMLUNIT)
File "c:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 63, in __init__
self.start_session(desired_capabilities, browser_profile)
File "c:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 105, in start_session
'desiredCapabilities': desired_capabilities,
File "c:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in execute
self.error_handler.check_response(response)
File "c:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 147, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'Error forwarding the new session cannot find : {platform=ANY, browserName=htmlunit, version=}' ; Stacktrace: Method process threw an error in RequestHandler.java
I use selenium-server-standalone-2.25.0.jar with the Python selenium module also in version 2.25. The Selenium server is running on localhost and it works fine with e.g. DesiredCapabilities.FIREFOX.
Do I have to install htmlunit manually? The selenium websites says that the standalone-jar contains all dependencies.