Python selenium error when trying to launch firefox -
i getting error when trying open firefox using selenium in ipython notebook. i've looked around , have found similar errors nothing matches error i'm getting. know problem might , how fix it? i'm using firefox 22.
the code typed in follows:
from selenium import webdriver driver = webdriver.firefox()
the error code returns follows:
windowserror traceback (most recent call last) <ipython-input-7-fd567e24185f> in <module>() ----> 1 driver = webdriver.firefox() c:\anaconda\lib\site-packages\selenium\webdriver\firefox\webdriver.pyc in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy) 56 remotewebdriver.__init__(self, 57 command_executor=extensionconnection("127.0.0.1", self.profile, ---> 58 self.binary, timeout), 59 desired_capabilities=capabilities) 60 self._is_remote = false c:\anaconda\lib\site-packages\selenium\webdriver\firefox\extension_connection.pyc in __init__(self, host, firefox_profile, firefox_binary, timeout) 45 self.profile.add_extension() 46 ---> 47 self.binary.launch_browser(self.profile) 48 _url = "http://%s:%d/hub" % (host, port) 49 remoteconnection.__init__( c:\anaconda\lib\site-packages\selenium\webdriver\firefox\firefox_binary.pyc in launch_browser(self, profile) 45 self.profile = profile 46 ---> 47 self._start_from_profile_path(self.profile.path) 48 self._wait_until_connectable() 49 c:\anaconda\lib\site-packages\selenium\webdriver\firefox\firefox_binary.pyc in _start_from_profile_path(self, path) 71 72 popen(command, stdout=pipe, stderr=stdout, ---> 73 env=self._firefox_env).communicate() 74 command[1] = '-foreground' 75 self.process = popen( c:\anaconda\lib\subprocess.pyc in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags) 677 p2cread, p2cwrite, 678 c2pread, c2pwrite, --> 679 errread, errwrite) 680 681 if mswindows: c:\anaconda\lib\subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) 894 env, 895 cwd, --> 896 startupinfo) 897 except pywintypes.error, e: 898 # translate pywintypes.error windowserror, windowserror: [error 2] system cannot find file specified
try specify firefox binary when initialize firefox()
from selenium import webdriver selenium.webdriver.firefox.firefox_binary import firefoxbinary binary = firefoxbinary('path/to/binary') driver = webdriver.firefox(firefox_binary=binary)
the default path firefoxdriver looking @ %programfiles%\mozilla firefox\firefox.exe
. see firefoxdriver
or add path of firefox binary windows' path.
Comments
Post a Comment