当我运行时(WinXP OS,Python2.7)
wd = webdriver.Remote (command_executor = 'http://127.0.0.1:4444/hub', desired_capabilities = webdriver.DesiredCapabilities.INTERNETEXPLORER)在我的系统中,默认有一个代理服务器,并通过代理连接到selenium- server :4444a。如何建立这种连接直接转到selenium-server:4444。
发布于 2014-02-18 22:23:56
有点晚了,但我今天遇到了同样的问题,并解决了它,所以对于下一个搜索的人来说,这是解决方案:
系统代理设置是从*_proxy windows环境变量(http_proxy、https_proxy、ftp_proxy等)中获取的,因此,如果您在其中定义了公司代理,则将使用它。
在windows选项中添加新的环境变量,或者,如果使用intelliJ IDEA,则在运行配置设置中添加新环境变量:
no_proxy=localhost,127.0.0.1在python-2.7.6/Lib/urllib.py中,在1387行附近可以找到原因:
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 0https://stackoverflow.com/questions/12636466
复制相似问题