【发布时间】:2015-02-27 10:41:50
【问题描述】:
我在 Mac OS 中遇到了使用 python 的 selenium 问题。 Python 2.7 pydev 3.0
我的示例代码
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://www.formsite.com/")
driver.maximize_window()
driver.close()
使用 PIP 安装 selenium
pip install selenium
Downloading/unpacking selenium
Downloading selenium-2.44.0.tar.gz (2.6MB): 2.6MB downloaded
Running setup.py (path:/private/var/folders/qw/ctlmndfd5ts9w2p6v1qc382r0000gn/T/pip_build_bhanusaa/selenium/setup.py) egg_info for package selenium
Installing collected packages: selenium
Running setup.py install for selenium
Successfully installed selenium
在 Python 路径库中分配了 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
低于错误
Traceback (most recent call last):
File "/Users/bhanusaa/Desktop/samp/src/scripts/new.py", line 3, in <module>
driver = webdriver.Firefox()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
self.binary, timeout),
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 65, in launch_browser
self._start_from_profile_path(self.profile.path)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 88, in _start_from_profile_path
env=self._firefox_env).communicate()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
【问题讨论】:
-
请在此处查看解决方案:stackoverflow.com/questions/13570003/…
-
您提供的链接是关于 python unittest 框架工作的,(即使我尝试了您提供的链接中的代码也会导致相同的错误)我收到“OSError: [Errno 2] No such文件或目录”
标签: python eclipse macos selenium pydev