2016-04-13 7 views
0

Das Skript ist:Warum kann ich dieses einfache Beispiel nicht mit Selen ausführen?

from selenium import webdriver 

driver = webdriver.Firefox() 
driver.get("http://www.python.org") 

und diese kommen:

/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/GeniusV/Documents/pythonProject/untitled/hj.py 
Traceback (most recent call last): 
    File "/Users/GeniusV/Documents/pythonProject/untitled/hj.py", line 5, in <module> 
    driver = webdriver.Firefox() 
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 103, in __init__ 
    self.binary, timeout) 
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__ 
    self.binary.launch_browser(self.profile, timeout=timeout) 
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 67, in launch_browser 
    self._start_from_profile_path(self.profile.path) 
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 90, in _start_from_profile_path 
    env=self._firefox_env) 
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__ 
    errread, errwrite) 
    File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child 
    raise child_exception 

OSError: [Errno 2] No such file or directory 

ich wirklich nicht verstehen, warum es Problem ist mein Python oder Selen ist?

Antwort

1

Klingt wie ein Kompatibilitätsproblem.

Vergewissern Sie sich die neuesten Selen verwenden:

pip install --upgrade selenium 

und haben die neueste Firefox installiert.

+0

Vielen Dank, ich neu installieren den Firefox und es funktioniert. – Daniel

Verwandte Themen