首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Webdriver通过代理连接到selenium-server:4444a

Webdriver通过代理连接到selenium-server:4444a
EN

Stack Overflow用户
提问于 2012-09-28 16:36:24
回答 1查看 688关注 0票数 1

当我运行时(WinXP OS,Python2.7)

代码语言:javascript
复制
wd = webdriver.Remote (command_executor = 'http://127.0.0.1:4444/hub', desired_capabilities = webdriver.DesiredCapabilities.INTERNETEXPLORER)

在我的系统中,默认有一个代理服务器,并通过代理连接到selenium- server :4444a。如何建立这种连接直接转到selenium-server:4444。

EN

回答 1

Stack Overflow用户

发布于 2014-02-18 22:23:56

有点晚了,但我今天遇到了同样的问题,并解决了它,所以对于下一个搜索的人来说,这是解决方案:

系统代理设置是从*_proxy windows环境变量(http_proxy、https_proxy、ftp_proxy等)中获取的,因此,如果您在其中定义了公司代理,则将使用它。

在windows选项中添加新的环境变量,或者,如果使用intelliJ IDEA,则在运行配置设置中添加新环境变量:

代码语言:javascript
复制
no_proxy=localhost,127.0.0.1

在python-2.7.6/Lib/urllib.py中,在1387行附近可以找到原因:

代码语言:javascript
复制
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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12636466

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档