Dear All, I am trying to create remote webdriver with python binding but getting WebDriverException with no message.
selenium grid: 3.12.0, Linux python binding version: 3.12.0, running on OSX
python version: 2.7.15
There is also a Github ticket: https://github.com/SeleniumHQ/selenium/issues/6027. Does anyone have any idea of why this could be happening? Thanks a lot.
Python 2.7.15 (default, Jun 9 2018, 00:09:15)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
>>> driver = webdriver.Remote(command_executor='http://myhub-url/wd/hub', desired_capabilities=DesiredCapabilities.CHROME)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 245, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 314, in execute
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 208, in check_response
Notice that in working version, there is an additional Json object in capabilities: desiredCapabilities.
Without this, the grid throws NullPointer.
This is with one grid. I think the issue is that the grid is old (still >3 version as far as I know) and is expecting different request format. I guess python binding is not compatible with old grid.
With another grid, the issue was the resolution of hostname to IP. In our scenario, selenium hub is behind load balancer so IP resolves in correctly. As resolve_ip is set to True by default and there is no way to change that while creating remote driver, it was resolving to wrong IP and was giving error.
Now solution for me is:
1. Find a version of python binding that is compatible with my old grid.
2. Use new version of python binding with new grid: Override webdriver class and set resolve_ip to False while creating RemoteConnection object.