2

The following code:

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)

Is generating the following errors:

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

Has anybody seen this behavior before?

(Python 2.7, Windows 7)

Thanks! /YGA

Helping Hands
  • 5,292
  • 9
  • 60
  • 127
YGA
  • 9,546
  • 15
  • 47
  • 50
  • 2
    First, you should be using `os.path.join`, not `str.join`. But, more importantly, are you sure that there actually is an executable named `C:\FirefoxPortable\FirefoxPortable.exe` on your drive? Because the error is telling you that it can't find one. – abarnert May 06 '15 at 02:09
  • 1
    why are you using join at all? – Padraic Cunningham May 06 '15 at 02:10
  • 1
    @PadraicCunningham: Good point, actually… – abarnert May 06 '15 at 02:10
  • Thanks! The issue was the str.join vs the os.path.join. If you want to submit as answer, I'll check it as correct and you can get the credit. – YGA May 06 '15 at 02:20

0 Answers0