Selenium python - Acess denied to /hub/session when launching Firefox webdriver

隐身守侯 提交于 2020-01-13 03:54:27

问题


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?


回答1:


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




回答2:


I met the same issue on Windows 7 , after uncheck all proxy-related options in "Internet Options" , no error any more



来源:https://stackoverflow.com/questions/8342830/selenium-python-acess-denied-to-hub-session-when-launching-firefox-webdriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!