无法在mac中使用python启动selenium
我在Mac OS中使用python的selenium遇到了一个问题。。 Python 2.7 pydev 3.0 我的示例代码无法在mac中使用python启动selenium,python,eclipse,macos,selenium,pydev,Python,Eclipse,Macos,Selenium,Pydev,我在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 Download
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包
低于错误值
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
回溯(最近一次呼叫最后一次):
文件“/Users/bhanusaa/Desktop/samp/src/scripts/new.py”,第3行,在
driver=webdriver.Firefox()
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/selenium/webdriver/firefox/webdriver.py”,第59行,在__
self.binary,超时),
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/selenium/webdriver/firefox/extension_connection.py”,第47行,在u init中__
self.binary.launch_浏览器(self.profile)
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/selenium/webdriver/firefox/firefox\u binary.py”,第65行,在启动浏览器中
self.\u从配置文件路径开始(self.profile.path)
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/selenium/webdriver/firefox/firefox\u binary.py”,第88行,在\u start\u from\u profile\u路径中
env=self.\u firefox\u env.communicate()
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”,第711行,在__
错误读取,错误写入)
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”,第1308行,在执行子进程中
引发子对象异常
OSError:[Errno 2]没有这样的文件或目录
您好,问题现在解决了,以前我在Mac电脑上安装了Firefox 34.0,现在降级到30.0,现在工作正常。请查看此处以了解解决方案:您提供的链接是关于python unittest框架的(即使我在您提供的链接中尝试了代码,但结果相同),我得到了“OSError:[Errno 2]没有这样的文件或目录“