Skip to content

Commit dac45e6

Browse files
committed
Update Firefox settings
1 parent 907b1ed commit dac45e6

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def _set_firefox_options(
381381
options.set_preference("security.csp.enable", False)
382382
options.set_preference(
383383
"browser.download.manager.showAlertOnComplete", False)
384-
if headless:
384+
if headless and "linux" not in PLATFORM:
385385
options.add_argument("--headless")
386386
if locale_code:
387387
options.set_preference("intl.accept_languages", locale_code)
@@ -579,6 +579,11 @@ def get_remote_driver(
579579
downloads_path, headless, locale_code,
580580
proxy_string, user_agent, disable_csp)
581581
capabilities = firefox_options.to_capabilities()
582+
capabilities['marionette'] = True
583+
if "linux" in PLATFORM:
584+
if headless:
585+
capabilities['moz:firefoxOptions'] = (
586+
{'args': ['-headless']})
582587
for key in desired_caps.keys():
583588
capabilities[key] = desired_caps[key]
584589
warnings.simplefilter("ignore", category=DeprecationWarning)
@@ -703,7 +708,19 @@ def get_local_driver(
703708
"%s" % e)
704709
sys.argv = sys_args # Put back the original sys args
705710
warnings.simplefilter("ignore", category=DeprecationWarning)
706-
return webdriver.Firefox(options=firefox_options)
711+
if "linux" in PLATFORM:
712+
from selenium.webdriver.common.desired_capabilities import (
713+
DesiredCapabilities)
714+
firefox_capabilities = DesiredCapabilities.FIREFOX.copy()
715+
firefox_capabilities['marionette'] = True
716+
if headless:
717+
firefox_capabilities['moz:firefoxOptions'] = (
718+
{'args': ['-headless']})
719+
return webdriver.Firefox(
720+
capabilities=firefox_capabilities,
721+
options=firefox_options)
722+
else:
723+
return webdriver.Firefox(options=firefox_options)
707724
elif browser_name == constants.Browser.INTERNET_EXPLORER:
708725
if not IS_WINDOWS:
709726
raise Exception(

0 commit comments

Comments
 (0)