Skip to content

Commit 21bbdf5

Browse files
committed
on osx for firefox, fallback to checking homebrew install, if the default isn't there
1 parent 19184fe commit 21bbdf5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

java/client/src/org/openqa/selenium/firefox/internal/Executable.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ private static File locateFirefoxBinaryFromPlatform() {
160160

161161
} else if (current.is(MAC)) {
162162
binary = new File("/Applications/Firefox.app/Contents/MacOS/firefox-bin");
163+
// fall back to homebrew install location if default is not found
164+
if (!binary.exists()) {
165+
binary = new File(System.getProperty("user.home") + binary.getAbsolutePath());
166+
}
163167
}
164168

165169
if (binary != null && binary.exists()) {

py/selenium/webdriver/firefox/firefox_binary.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ def _get_firefox_start_cmd(self):
143143
"""Return the command to start firefox."""
144144
start_cmd = ""
145145
if platform.system() == "Darwin":
146-
start_cmd = ("/Applications/Firefox.app/Contents/MacOS/firefox-bin")
146+
start_cmd = "/Applications/Firefox.app/Contents/MacOS/firefox-bin"
147+
# fallback to homebrew installation for mac users
148+
if not os.path.exists(start_cmd):
149+
start_cmd = os.path.expanduser("~") + start_cmd
147150
elif platform.system() == "Windows":
148151
start_cmd = (self._find_exe_in_registry() or
149152
self._default_windows_location())

0 commit comments

Comments
 (0)