问题
I'm facing an issue with selenium with python in Mac OS.. Python 2.7 pydev 3.0
My sample code
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://www.formsite.com/")
driver.maximize_window()
driver.close()
Installed selenium using PIP
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
Assigned /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
in Python Path library

getting below error
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
回答1:
HI the issue is resolved now, previously i had installed Firefox 34.0 in my Mac and now downgraded to 30.0, now it is working fine.
来源:https://stackoverflow.com/questions/27719471/unable-to-launch-selenium-with-python-in-mac