Skip to content

Commit

Permalink
Use which() to get Firefox path on Mac OS (#10818)
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

Co-authored-by: Simon K <jackofspaces@gmail.com>
Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 29, 2022
1 parent 7a13e93 commit de0a144
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 de0a144

Please sign in to comment.