首页 文章

selenium python webdriver.Firefox()无法连接

提问于
浏览
0

我在python中尝试使用selenium非常简单的东西

from selenium import webdriver
q = webdriver.Firefox()

我收到了这个回复

Traceback (most recent call last):
  File "", line 1, in 
  File "/home/rcortes/.local/lib/python2.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 61, in __init__
    desired_capabilities=capabilities)
  File "/home/rcortes/.local/lib/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 72, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/rcortes/.local/lib/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 114, in start_session
    'desiredCapabilities': desired_capabilities,
  File "/home/rcortes/.local/lib/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 165, in execute
    self.error_handler.check_response(response)
  File "/home/rcortes/.local/lib/python2.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 136, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: u'\n\n\n\nNotification: Gateway Timeout\n\n\nbody {\n  font-family: Arial, Helvetica, sans-serif;\n  font-size: 14px;\n  color:#333333;\n  background-color: #ffffff;\n}\nh1 {\n  font-size: 18px;\n  font-weight: bold;\n  text-decoration: none;\n  padding-top: 0px;\n  color: #2970A6;\n}\na:link {\n    color: #2970A6;\n  text-decoration: none;\n}\na:hover {\n    color: #2970A6;\n  text-decoration: underline;\n}\np.buttonlink {\n  margin-bottom: 24px;\n}\n.copyright {\n  font-size: 12px;\n  color: #666666;\n  margin: 5px 5px 0px 30px;\n\n}\n.details {\n  font-size: 14px;\n  color: #969696;\n  border: none;\n  padding: 20px 20px 20px 20px;\n  margin: 0px 10px 10px 35px;\n}\n\n.shadow {\n  border: 3px solid #9f9f9f;\n  padding: 10px 25px 10px 25px;\n  margin: 10px 35px 0px 30px;\n  background-color: #ffffff;\n  width: 600px;\n\n  -moz-box-shadow: 3px 3px 3px #cccccc;\n  -webkit-box-shadow: 3px 3px 3px #cccccc;\n  box-shadow: 3px 3px 3px #cccccc;\n  /* For IE 8 */\n  -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=5, Direction=135, Color=\'cccccc\')";\n  /* For IE 5.5 - 7 */\n  filter: progid:DXImageTransform.Microsoft.Shadow(Strength=5, Direction=135, Color=\'cccccc\');\n}\n.logo {\n  border: none;\n  margin: 5px 5px 0px 30px;\n}\n\n\n\n\n\n   \n\n This Page Cannot Be Displayed \n\n\n \nThe system cannot communicate with the external server ( 127.0.0.1 ).\nThe Internet server may be busy, may be permanently down, or may be\nunreachable because of network problems.\n \n\n \nPlease check the spelling of the Internet address entered.\nIf it is correct, try this request later.\n \n\n\n\n \nIf you have questions, please contact\nyour corporate network administrator \nand provide the codes shown below.\n \n\n\n\n \nDate: Thu, 17 Oct 2013 17:48:26 PDT \nUsername: \nSource IP: 10.130.49.59 \nURL: POST http://127.0.0.1/hub/session \nCategory: Infrastructure and Content Delivery Networks \nReason: UNKNOWN \nNotification: GATEWAY_TIMEOUT\n \n\n'

我想按照这些简单的指示http://docs.seleniumhq.org/docs/03_webdriver.jsp . 请帮忙

1 回答

  • 0

    我想到了 . 即使firefox禁用了Intranet站点的代理,我相信selenium仍然试图通过代理连接到服务器 . 我刚刚禁用了代理,它工作正常 .

相关问题