Skip to content

Commit 120ae59

Browse files
committed
Prevent some websites from detecting automation
1 parent b77cc5c commit 120ae59

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ def _set_chrome_options(
253253
chrome_options.add_argument("--disable-prompt-on-repost")
254254
if servername != "localhost":
255255
use_auto_ext = True # Use Automation Extension with the Selenium Grid
256-
if not use_auto_ext: # (It's ON by default. Disable it when not wanted.)
256+
if not use_auto_ext: # Disable Automation Extension / detection. (Default)
257+
if browser_name != constants.Browser.OPERA:
258+
chrome_options.add_argument(
259+
"--disable-blink-features=AutomationControlled")
257260
chrome_options.add_experimental_option("useAutomationExtension", False)
258261
if (settings.DISABLE_CSP_ON_CHROME or disable_csp) and not headless:
259262
# Headless Chrome doesn't support extensions, which are required
@@ -790,6 +793,8 @@ def get_local_driver(
790793
prefs["profile.managed_default_content_settings.images"] = 2
791794
edge_options.add_experimental_option("prefs", prefs)
792795
edge_options.add_experimental_option("w3c", True)
796+
edge_options.add_argument(
797+
"--disable-blink-features=AutomationControlled")
793798
edge_options.add_experimental_option(
794799
"useAutomationExtension", False)
795800
edge_options.add_experimental_option(

0 commit comments

Comments
 (0)