以下代码:
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium import webdriver
FIREFOX_PATH = "\\".join(["C:",
"FirefoxPortable", "FirefoxPortable.exe"])
binary = FirefoxBinary(FIREFOX_PATH)
browser = webdriver.Firefox(firefox_binary=binary)
产生以下错误:
Traceback (most recent call last):
File "run_selenium.py", line 13, in <module>
browser = webdriver.Firefox(firefox_binary=binary)
File "/usr/lib/python2.7/site-packages/selenium-2.45.0-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
self.binary, timeout),
File "/usr/lib/python2.7/site-packages/selenium-2.45.0-py2.7.egg/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "/usr/lib/python2.7/site-packages/selenium-2.45.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 65, in launch_browser
self._start_from_profile_path(self.profile.path)
File "/usr/lib/python2.7/site-packages/selenium-2.45.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 88, in _start_from_profile_path
env=self._firefox_env).communicate()
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
以前有人见过这种行为吗?
(Python 2.7,Windows 7)
谢谢! / YGA