Skip to content

Commit fd3ca4e

Browse files
committed
Update Firefox options and settings
1 parent 36f229b commit fd3ca4e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,6 +2024,7 @@ def _set_firefox_options(
20242024
disable_csp,
20252025
firefox_arg,
20262026
firefox_pref,
2027+
external_pdf,
20272028
):
20282029
blank_p = "about:blank"
20292030
options = webdriver.FirefoxOptions()
@@ -2035,7 +2036,6 @@ def _set_firefox_options(
20352036
options.set_preference("browser.newtab.url", blank_p)
20362037
options.set_preference("trailhead.firstrun.branches", "nofirstrun-empty")
20372038
options.set_preference("browser.aboutwelcome.enabled", False)
2038-
options.set_preference("pdfjs.disabled", True)
20392039
options.set_preference("app.update.auto", False)
20402040
options.set_preference("app.update.enabled", False)
20412041
options.set_preference("browser.formfill.enable", False)
@@ -2122,13 +2122,20 @@ def _set_firefox_options(
21222122
options.set_preference(
21232123
"browser.helperApps.neverAsk.saveToDisk",
21242124
(
2125-
"application/pdf, application/zip, application/octet-stream, "
2126-
"text/csv, text/xml, application/xml, text/plain, "
2127-
"text/octet-stream, application/x-gzip, application/x-tar "
2128-
"application/"
2129-
"vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2125+
"application/pdf,application/zip,application/octet-stream,"
2126+
"text/csv,text/xml,application/xml,text/plain,application/json,"
2127+
"text/octet-stream,application/x-gzip,application/x-tar,"
2128+
"application/java-archive,text/x-java-source,java,"
2129+
"application/javascript,video/jpeg,audio/x-aac,image/svg+xml,"
2130+
"application/x-font-woff,application/x-7z-compressed,"
2131+
"application/mp4,video/mp4,audio/mp4,video/x-msvideo,"
2132+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
21302133
),
21312134
)
2135+
if external_pdf:
2136+
options.set_preference("pdfjs.disabled", True)
2137+
else:
2138+
options.set_preference("pdfjs.disabled", False)
21322139
if firefox_arg:
21332140
# Can be a comma-separated list of Firefox args
21342141
firefox_arg_list = firefox_arg.split(",")
@@ -2768,6 +2775,7 @@ def get_remote_driver(
27682775
disable_csp,
27692776
firefox_arg,
27702777
firefox_pref,
2778+
external_pdf,
27712779
)
27722780
capabilities = webdriver.FirefoxOptions().to_capabilities()
27732781
capabilities["marionette"] = True
@@ -3050,6 +3058,7 @@ def get_local_driver(
30503058
disable_csp,
30513059
firefox_arg,
30523060
firefox_pref,
3061+
external_pdf,
30533062
)
30543063
if LOCAL_GECKODRIVER and os.path.exists(LOCAL_GECKODRIVER):
30553064
try:

0 commit comments

Comments
 (0)