Skip to content

Commit de0a144

Browse files
bogdancondurachesymonkdiemol
authored
Use which() to get Firefox path on Mac OS (#10818)
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>
1 parent 7a13e93 commit de0a144

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

py/selenium/webdriver/firefox/firefox_binary.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ def _get_firefox_start_cmd(self):
150150
"""Return the command to start firefox."""
151151
start_cmd = ""
152152
if self.platform == "darwin": # small darwin due to lower() in self.platform
153-
start_cmd = "/Applications/Firefox.app/Contents/MacOS/firefox-bin"
153+
ffname = "firefox"
154+
start_cmd = self.which(ffname)
155+
# use hardcoded path if nothing else was found by which()
156+
if not start_cmd:
157+
start_cmd = "/Applications/Firefox.app/Contents/MacOS/firefox-bin"
154158
# fallback to homebrew installation for mac users
155159
if not os.path.exists(start_cmd):
156160
start_cmd = os.path.expanduser("~") + start_cmd

0 commit comments

Comments
 (0)