Skip to content

Commit

Permalink
Use which() to get Firefox path on Mac OS
Browse files Browse the repository at this point in the history
The Firefox binary under Mac OS was using a hardcoded path. This was
failing when trying to manipulate PATH env var to use firefox from a
different location or if Firefox was installed in a different place.

Fixes #10686
  • Loading branch information
bogdancondurache committed Jun 27, 2022
1 parent 2fbfc62 commit 890ef3f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion py/selenium/webdriver/firefox/firefox_binary.py
Expand Up @@ -150,7 +150,11 @@ def _get_firefox_start_cmd(self):
"""Return the command to start firefox."""
start_cmd = ""
if self.platform == "darwin": # small darwin due to lower() in self.platform
start_cmd = "/Applications/Firefox.app/Contents/MacOS/firefox-bin"
ffname = "firefox"
start_cmd = self.which(ffname)
# use hardcoded path if nothing else was found by which()
if not start_cmd:
start_cmd = "/Applications/Firefox.app/Contents/MacOS/firefox-bin"
# fallback to homebrew installation for mac users
if not os.path.exists(start_cmd):
start_cmd = os.path.expanduser("~") + start_cmd
Expand Down

0 comments on commit 890ef3f

Please sign in to comment.