Skip to content

Commit 4bacd83

Browse files
committed
If using Chrome extensions, don't use Incognito / Guest Mode
1 parent 6d65c79 commit 4bacd83

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,22 @@ def _set_chrome_options(
175175
chrome_options.add_experimental_option(
176176
"mobileEmulation", emulator_settings)
177177
chrome_options.add_argument("--enable-sync")
178-
if incognito:
179-
chrome_options.add_argument("--incognito")
180-
elif guest_mode:
181-
chrome_options.add_argument("--guest")
182-
else:
183-
pass
178+
if not proxy_auth and not disable_csp and (
179+
not extension_zip and not extension_dir):
180+
if incognito:
181+
# Use Chrome's Incognito Mode
182+
# Incognito Mode prevents Chrome extensions from loading,
183+
# so if using extensions or a feature that uses extensions,
184+
# then Chrome's Incognito mode will be disabled instead.
185+
chrome_options.add_argument("--incognito")
186+
elif guest_mode:
187+
# Use Chrome's Guest Mode
188+
# Guest mode prevents Chrome extensions from loading,
189+
# so if using extensions or a feature that uses extensions,
190+
# then Chrome's Guest Mode will be disabled instead.
191+
chrome_options.add_argument("--guest")
192+
else:
193+
pass
184194
if user_data_dir:
185195
abs_path = os.path.abspath(user_data_dir)
186196
chrome_options.add_argument("user-data-dir=%s" % abs_path)

0 commit comments

Comments
 (0)