我很确定这将是一个头上的骗子,但是我一直在追踪我能找到的任何文档,并且我无法摆脱这个错误。我正在设置Selenium Grid(在Docker中),并且只有在未指定远程服务器的情况下,才能运行测试。这是代码
def setUp(self):
self.browser = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.CHROME)
FWIW,这很好用,但是在没有command_executor的网格环境中没有用:
def setUp(self):
self.browser = webdriver.Chrome()
基于多个来源,包括https://hackr.io/blog/complete-guide-selenium-webdriver,对RemoteWebDriver的调用应该是正确的。
这是错误:
ERROR: test_hackernews_search_for_selenium (__main__.HackerNewsSearchTest)
Traceback (most recent call last):
File "test.py", line 16, in setUp
self.browser = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.CHROME)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: None
答案 0 :(得分:1)
此错误消息...
ERROR: test_hackernews_search_for_selenium (__main__.HackerNewsSearchTest)
Traceback (most recent call last):
File "test.py", line 16, in setUp
self.browser = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.CHROME)
.
WebDriverException: Message: None
...表示客户端程序无法启动新的 Web浏览会话,即 Chrome浏览器会话。
您的主要问题是 Selenium Grid Hub 和 Selenium Grid Node 之间的连通性。
确保满足以下条件: