代码:
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
本文介绍了一种在使用Selenium WebDriver进行自动化测试时遇到的问题,当浏览器类型设置为HtmlUnit时,启动会报错。文章提供了错误信息及解决方法,即在启动selenium-server-node时需指定HtmlUnit。
5万+

被折叠的 条评论
为什么被折叠?



