【问题标题】:Firefox does not display URL while invoked from Python-SeleniumFirefox 从 Python-Selenium 调用时不显示 URL
【发布时间】:2012-03-23 18:16:32
【问题描述】:

我尝试使用http://pypi.python.org/pypi/selenium 中提到的示例代码,它会调用 Firefox 浏览器并将 URL 放入地址栏中。

Firefox 浏览器确实启动了,但它没有将 URL 放入地址中,并且程序在没有足够信息的情况下抛出异常..

Traceback (most recent call last):
  File "C:/Documents and Settings/paithankar/Desktop/test", line 6, in <module>
    browser = webdriver.Firefox() # Get local session of firefox
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 46, in __init__
    desired_capabilities=DesiredCapabilities.FIREFOX)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 60, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 102, in start_session
    'desiredCapabilities': desired_capabilities,
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 153, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 125, in check_response
    raise exception_class(value)
WebDriverException: Message: ''

有人知道这里出了什么问题吗?

【问题讨论】:

    标签: python firefox selenium


    【解决方案1】:

    您是否运行了 java selenium 驱动程序? ... java -jar selenium-server-standalone-2.20.0.jar

    【讨论】:

    • 我不这么认为。我让它继续在我的机器上运行吗?
    • 是的,你需要让它继续运行。
    • 顺便说一句,我使用的是 Selenium 2,它不需要运行这个 jar。
    • 您发布的链接适用于 Selenium 2,这就是运行 jar 的内容。
    • 即使在运行服务器后也没有运气......同样的问题
    【解决方案2】:

    Selenium Server 不需要与 Selenium 2 WebDriver 一起运行。

    来自 SeleniumHQ:“如果您只使用 WebDriver API,则不需要 Selenium-Server。”

    http://docs.seleniumhq.org/docs/03_webdriver.jsp#webdriver-and-the-selenium-server

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-26
      • 2021-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-13
      • 1970-01-01
      • 2017-07-09
      相关资源
      最近更新 更多