![](/img/trans.png)
[英]WebDriverException on invoking webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.CHROME) through Selenium and Python
[英]Webdriver connected to selenium-server:4444 a through proxy
运行时(WinXP OS,Python 2.7)
wd = webdriver.Remote (command_executor = 'http://127.0.0.1:4444/hub', desired_capabilities = webdriver.DesiredCapabilities.INTERNETEXPLORER)
在我的系统中,默认情况下有一个代理服务器,并且通过代理连接到selenium-server:4444 a。 如何建立连接直接转到selenium-server:4444。
有点晚了,但是我今天偶然发现了同样的问题并解决了,所以对于下一个搜索的人,这是解决方案:
系统代理设置是从* _proxy Windows环境变量(http_proxy,https_proxy,ftp_proxy等)中获取的,因此,如果您在此处定义了公司代理,则将使用它。
在Windows选项中添加一个新的环境变量,或者在运行配置设置中添加一个新的环境变量:
no_proxy=localhost,127.0.0.1
在第1387行附近的python-2.7.6 / Lib / urllib.py中会找到原因:
def proxy_bypass_environment(host):
"""Test if proxies should not be used for a particular host.
Checks the environment for a variable named no_proxy, which should
be a list of DNS suffixes separated by commas, or '*' for all hosts.
"""
no_proxy = os.environ.get('no_proxy', '') or os.environ.get('NO_PROXY', '')
# '*' is special case for always bypass
if no_proxy == '*':
return 1
# strip port off host
hostonly, port = splitport(host)
# check if the host ends with any of the DNS suffixes
no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')]
for name in no_proxy_list:
if name and (hostonly.endswith(name) or host.endswith(name)):
return 1
# otherwise, don't bypass
return 0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.