Skip to content

Commit 0cbab82

Browse files
authored
Fix emrun suite on Windows to locate default system browsers (#26920)
1 parent 817496e commit 0cbab82

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

test/browser_common.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,18 @@ def configure_test_browser():
339339
if not shutil.which(EMTEST_BROWSER):
340340
EMTEST_BROWSER = 'firefox'
341341
if not shutil.which(EMTEST_BROWSER):
342+
# FIXME: This should really be an error, but this code currently also runs for non-browser tests.
343+
EMTEST_BROWSER = 'default-browser-not-found'
344+
342345
if MACOS and os.path.isdir('/Applications/Safari.app'):
343346
EMTEST_BROWSER = '/Applications/Safari.app'
344-
else:
345-
# FIXME: This should really be and error, but this code currently also runs for non-browser tests.
346-
EMTEST_BROWSER = 'default-browser-not-found'
347+
elif WINDOWS:
348+
for browser in [
349+
f'{os.getenv("ProgramFiles(x86)", "")}\\Microsoft\\Edge\\Application\\msedge.exe',
350+
f'{os.getenv("ProgramFiles", "")}\\Mozilla Firefox\\firefox.exe',
351+
f'{os.getenv("LOCALAPPDATA", "")}\\Google\\Chrome SxS\\Application\\chrome.exe']:
352+
if os.path.isfile(browser):
353+
EMTEST_BROWSER = browser
347354

348355
if WINDOWS and '"' not in EMTEST_BROWSER and "'" not in EMTEST_BROWSER:
349356
# On Windows env. vars canonically use backslashes as directory delimiters, e.g.

0 commit comments

Comments
 (0)