Selenium python - 启动Firefox webdriver时,拒绝/ hub / session [英] Selenium python - Acess denied to /hub/session when launching Firefox webdriver

查看:402
本文介绍了Selenium python - 启动Firefox webdriver时,拒绝/ hub / session的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用Selenium Webdriver(而不是Selenium 1.0),我正在努力解决一个阻止我运行测试的问题:尝试启动webdriver.Firefox()时,我得到一个WebDriverException, see traceback

异常在初始化Firefox的webdriver时出现:

pre $ driver $ web driver $ Fire
$ $ $ / pre>

经过一些研究(我发现有关同一个问题的帖子),我怀疑公司代理人应该受到指责,定义了一个自定义的FirefoxProfile来为webdriver配置一个代理,但是这也没有帮助(尝试了无代理和手动代理设置,等于公司标准)。还尝试添加localhost / 127.0.0.1的异常,这也没有帮助。



有任何人面临同样的问题,并希望解决它?

解决方案

所以在经历了几天的同样的问题之后,我发现了这个帖子: http://osdir.com/ml/selenium-users/2011-07/msg01149.html 。原来,这可能是一个权限错误。尝试以root用户身份运行您的Python代码



编辑:谢谢史蒂夫!
到底是这个
这个问题不是直接做权限,而是用一个
的环境变量,当我们以root身份运行时,这个变量是没有被读取的。设置了http_proxy环境变量,没有为
localhost设置任何排除,这意味着Python客户端试图通过代理连接
到WebDriver,这在以root身份运行时不是问题
因为http_proxy没有设置。

这个问题可以通过设置local_host的no_proxy环境变量
来解决。



希望这可以帮助任何可能遇到相同
问题的人。


Steve
http://osdir.com/ml/selenium-users/2011-07/msg01169.html


I just recently started using Selenium Webdriver (as opposed to Selenium 1.0), and I am struggling with an issue that prevents me from running tests at all: When trying to launch webdriver.Firefox() i get an WebDriverException, see traceback

Exception occurs when initializing the Firefox webdriver:

driver = webdriver.Firefox()

After some research (where I found no posts about the same issue), I suspected that the company proxy was to blame, and defined a custom FirefoxProfile to configure a proxy for the webdriver, but that did not help either (tried both "no proxy" and manual proxy settings, equal to company standard). Also tried adding exception for localhost/127.0.0.1, that did not help either.

Has anyone faced the same issue, and hopefully solved it?

解决方案

So after struggling with the same problem for days on end, I came upon this post: http://osdir.com/ml/selenium-users/2011-07/msg01149.html. Turns out that it may be a permissions error. Try running your python code as a root user

Edit: Thanks steve! "Got to the bottom of this one. The issue was not directly to do with permissions but with an environment variable which was not read when we ran as root. We have the http_proxy environment variable set with no exclusions for localhost. This meant that the Python client was attempting to connect to the WebDriver via the proxy. This was not an issue when run as root because http_proxy was not set.

This issue can be fixed by setting the no_proxy environment variable for localhost.

Hope this is a help to anybody that may be experiencing the same issue.

Steve" http://osdir.com/ml/selenium-users/2011-07/msg01169.html

这篇关于Selenium python - 启动Firefox webdriver时,拒绝/ hub / session的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆