Skip to content

Commit 4c73a3c

Browse files
[py] Move platform to be initialised earlier before it is called
1 parent dfee907 commit 4c73a3c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

py/selenium/webdriver/firefox/firefox_binary.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self, firefox_path=None, log_file=None):
4343
# a while the pipe would fill up and Firefox would freeze.
4444
self._log_file = log_file or open(os.devnull, "wb")
4545
self.command_line = None
46+
self.platform = system().lower()
4647
if not self._start_cmd:
4748
self._start_cmd = self._get_firefox_start_cmd()
4849
if not self._start_cmd.strip():
@@ -59,7 +60,6 @@ def __init__(self, firefox_path=None, log_file=None):
5960
self._firefox_env["MOZ_CRASHREPORTER_DISABLE"] = "1"
6061
self._firefox_env["MOZ_NO_REMOTE"] = "1"
6162
self._firefox_env["NO_EM_RESTART"] = "1"
62-
self.platform = system().lower()
6363

6464
def add_command_line_options(self, *args):
6565
self.command_line = args
@@ -149,12 +149,12 @@ def _find_exe_in_registry(self):
149149
def _get_firefox_start_cmd(self):
150150
"""Return the command to start firefox."""
151151
start_cmd = ""
152-
if self.platform == "darwin": #small darwin due to lower() in self.platform
152+
if self.platform == "darwin": # small darwin due to lower() in self.platform
153153
start_cmd = "/Applications/Firefox.app/Contents/MacOS/firefox-bin"
154154
# fallback to homebrew installation for mac users
155155
if not os.path.exists(start_cmd):
156156
start_cmd = os.path.expanduser("~") + start_cmd
157-
elif self.platform == "windows": #same
157+
elif self.platform == "windows": # same
158158
start_cmd = (self._find_exe_in_registry() or self._default_windows_location())
159159
elif self.platform == 'java' and os._name == 'nt':
160160
start_cmd = self._default_windows_location()

0 commit comments

Comments
 (0)