代码:
driver = webdriver.Remote(
command_executor=' http://127.0.0.1:4444/wd/hub',
desired_capabilities={'platform': 'ANY',
'browserName': 'htmlunit',
'version': '',
'javascriptEnabled': True
})
运行的时候报:selenium.common.exceptions.WebDriverException: Message:
Error forwarding the new session cannot find : Capabilities [{browserName=htmlunit, javascriptEnabled=true, version=, platform=ANY}]
当时有点迷惑,我把 'browserName': ''的value换成chrome.firefox,IE都没有问题,就这个htmlunit报错,查资料发现这个在启动selenium-server node的时候要指定一下
java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://IP:4444/grid/register -browser browserName=htmlunit