Closed federicoparroni closed 3 years ago
According to these docs in urllib3 this is how to disable Name resolution for a given host name: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#custom-sni-hostname
Generally one should set up your environment to do the right thing (such as pointing to the right name server), but there are specific instances where this doesn’t work or may be beyond the skill set of the user.
I think rather than reintroduce resolve_ip
as a keyword option we should expose a method to change the RemoteConnection. we currently have a way to change timeouts so we can do something similar.
The real solution is to define your own RemoteConnection class that uses the custom SNI hostname and pass that in the webdriver class
browser = Webdriver(command_executor=MyCustomRemoteConnection, ...)
This has been a thing for a while, I found out recently.
Thank you so much @isaulv. I solved using the RemoteConnection class as you suggested:
from selenium.webdriver.remote.remote_connection import RemoteConnection
driver = webdriver.Remote(
command_executor=RemoteConnection('http://seleniumgrid.eng.aruba.it/wd/hub', resolve_ip=False),
...
)
closing this as the correct way to do it has been used.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
🚀 Feature Proposal
The resolve_ip param should be added to the remote WebDriver class.
Motivation
I am using the Remote Webdriver to attach to a Selenium grid cluster running on Kubernetes. Since I am using an Nginx ingress, there is an issue with the resolve IP functionality of the RemoteConnection class.
This code throws an exception since the hostname is resolved to the default backend IP. That IP is then used as the "Host" header value. Since Nginx does not know that virtualhost, the default backend response is returned: "default backend - 404".
Example