【问题标题】:Selenium not opening a webpageSelenium 不打开网页
【发布时间】:2015-09-14 17:22:10
【问题描述】:

当我运行以下代码时,我收到一个我不理解的错误,我认为这与我在计算机上设置 selenium 的方式有关。 (如果相关,我在 Mac OS 上)

from selenium import webdriver

driver = webdriver.Firefox()
driver.get('https://www.google.com')
driver.close()

当我尝试运行该程序时出现以下错误:

File "win.py", line 3, in <module> 
    driver = webdriver.Firefox()
File "/Users/shazam/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/firefox/webdriver.py", line 64, in __init__
    self.binary, timeout),
File "/Users/shazam/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__ 
    self.binary.launch_browser(self.profile)
File "/Users/shazam/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 69, in launch_browser 
    self._start_from_profile_path(self.profile.path)
File "/Users/shazam/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 92, in _start_from_profile_path 
    env=self._firefox_env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__ 
    errread, errwrite) 
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
    raise child_exception

【问题讨论】:

  • 嗨 Derek,如果有帮助,请检查一下 - Stack-17580730
  • 不,比那更好。您必须安装 Firefox 才能运行 Selenium 的 Firefox 版本。我会为自己找到一个耻辱的盒子。

标签: python macos selenium


【解决方案1】:

这个错误是因为我的电脑上没有安装 Firefox。对我来说应该很明显的东西,但不是。

【讨论】:

    猜你喜欢
    • 2017-12-12
    • 1970-01-01
    • 2021-09-25
    • 2015-04-10
    • 2014-02-02
    • 2017-08-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多