I'm trying to use selenium remote standalone server with htmlUnit driver with a python script.
First of all I start the standalone server with htmlUnit driver
java -cp htmlunit-driver-2.35.1-jar-with-dependencies.jar -jar selenium-server-standalone-3.141.0.jar
09:28:31.731 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.0, revision: 2ecb7d9a 09:28:31.810 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444 2019-05-08 09:28:31.857:INFO::main: Logging initialized @317ms to org.seleniumhq.jetty9.util.log.StdErrLog 09:28:32.059 INFO [WebDriverServlet.] - Initialising WebDriverServlet 09:28:32.543 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
After that I try to use htmlunit driver in my pyhton script
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',desired_capabilities={'browserName': 'htmlunit', 'version': '2','javascriptEnabled': True})
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
But I receive this error
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to create session from { "desiredCapabilities": { "browserName": "htmlunit", "javascriptEnabled": true, "version": "2" }, "capabilities": { "firstMatch": [ { "browserName": "htmlunit" }, { "browserName": "htmlunit", "browserVersion": "2" } ] } } Build info: version: '3.141.0', revision: '2ecb7d9a', time: '2018-10-31T20:22:52' System info: host: 'DESKTOP-xxxx', ip: 'xxx.xxx.xxx.xxx', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_212' Driver info: driver.version: unknown Stacktrace: at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$4 (NewSessionPipeline.java:76) at java.util.Optional.orElseThrow (None:-1) at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$5 (NewSessionPipeline.java:75) at java.util.Optional.orElseGet (None:-1) at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession (NewSessionPipeline.java:73) at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute (BeginSession.java:65) at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0 (WebDriverServlet.java:235) at java.util.concurrent.Executors$RunnableAdapter.call (None:-1) at java.util.concurrent.FutureTask.run (None:-1) at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1) at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1) at java.lang.Thread.run (None:-1)
I seem to have followed the documentation correctly, but I don't understand where the error could be.
Can you tell me how can I solve the problem?
Thank you