@@ -763,6 +763,7 @@ def _set_chrome_options(
763763 user_data_dir ,
764764 extension_zip ,
765765 extension_dir ,
766+ disable_features ,
766767 binary_location ,
767768 driver_version ,
768769 page_load_strategy ,
@@ -1044,6 +1045,7 @@ def _set_chrome_options(
10441045 binary_loc = detect_b_ver .get_binary_location (br_app , True )
10451046 if os .path .exists (binary_loc ):
10461047 binary_location = binary_loc
1048+ extra_disabled_features = []
10471049 if chromium_arg :
10481050 # Can be a comma-separated list of Chromium args
10491051 chromium_arg_list = chromium_arg .split ("," )
@@ -1069,8 +1071,13 @@ def _set_chrome_options(
10691071 )
10701072 if os .path .exists (binary_loc ):
10711073 binary_location = binary_loc
1074+ elif "disable-features=" in chromium_arg_item :
1075+ d_f = chromium_arg_item .split ("disable-features=" )[- 1 ]
1076+ extra_disabled_features .append (d_f )
10721077 elif len (chromium_arg_item ) >= 3 :
10731078 chrome_options .add_argument (chromium_arg_item )
1079+ if disable_features :
1080+ extra_disabled_features .extend (disable_features .split ("," ))
10741081 if devtools and not headless :
10751082 chrome_options .add_argument ("--auto-open-devtools-for-tabs" )
10761083 if user_agent :
@@ -1089,19 +1096,36 @@ def _set_chrome_options(
10891096 if headless or headless2 or is_using_uc (undetectable , browser_name ):
10901097 chrome_options .add_argument ("--disable-renderer-backgrounding" )
10911098 chrome_options .add_argument ("--disable-backgrounding-occluded-windows" )
1099+ chrome_options .add_argument ("--disable-client-side-phishing-detection" )
1100+ chrome_options .add_argument ("--disable-oopr-debug-crash-dump" )
1101+ chrome_options .add_argument ("--disable-top-sites" )
10921102 chrome_options .add_argument ("--ash-no-nudges" )
1103+ chrome_options .add_argument ("--no-crash-upload" )
10931104 chrome_options .add_argument ("--deny-permission-prompts" )
1105+ included_disabled_features = []
10941106 if user_data_dir :
1095- chrome_options .add_argument (
1096- "--disable-features=OptimizationHintsFetching,Translate,"
1097- "OptimizationTargetPrediction,PrivacySandboxSettings4,"
1098- "DownloadBubble,DownloadBubbleV2"
1099- )
1107+ included_disabled_features .append ("OptimizationHintsFetching" )
1108+ included_disabled_features .append ("Translate" )
1109+ included_disabled_features .append ("OptimizationTargetPrediction" )
1110+ included_disabled_features .append ("PrivacySandboxSettings4" )
1111+ included_disabled_features .append ("DownloadBubble" )
1112+ included_disabled_features .append ("DownloadBubbleV2" )
1113+ for item in extra_disabled_features :
1114+ if item not in included_disabled_features :
1115+ included_disabled_features .append (item )
1116+ d_f_string = "," .join (included_disabled_features )
1117+ chrome_options .add_argument ("--disable-features=%s" % d_f_string )
11001118 else :
1101- chrome_options .add_argument (
1102- "--disable-features=OptimizationHintsFetching,Translate,"
1103- "OptimizationTargetPrediction,DownloadBubble,DownloadBubbleV2"
1104- )
1119+ included_disabled_features .append ("OptimizationHintsFetching" )
1120+ included_disabled_features .append ("Translate" )
1121+ included_disabled_features .append ("OptimizationTargetPrediction" )
1122+ included_disabled_features .append ("DownloadBubble" )
1123+ included_disabled_features .append ("DownloadBubbleV2" )
1124+ for item in extra_disabled_features :
1125+ if item not in included_disabled_features :
1126+ included_disabled_features .append (item )
1127+ d_f_string = "," .join (included_disabled_features )
1128+ chrome_options .add_argument ("--disable-features=%s" % d_f_string )
11051129 if (
11061130 is_using_uc (undetectable , browser_name )
11071131 and (
@@ -1338,6 +1362,7 @@ def get_driver(
13381362 user_data_dir = None ,
13391363 extension_zip = None ,
13401364 extension_dir = None ,
1365+ disable_features = None ,
13411366 binary_location = None ,
13421367 driver_version = None ,
13431368 page_load_strategy = None ,
@@ -1550,6 +1575,7 @@ def get_driver(
15501575 user_data_dir ,
15511576 extension_zip ,
15521577 extension_dir ,
1578+ disable_features ,
15531579 binary_location ,
15541580 driver_version ,
15551581 page_load_strategy ,
@@ -1605,6 +1631,7 @@ def get_driver(
16051631 user_data_dir ,
16061632 extension_zip ,
16071633 extension_dir ,
1634+ disable_features ,
16081635 binary_location ,
16091636 driver_version ,
16101637 page_load_strategy ,
@@ -1664,6 +1691,7 @@ def get_remote_driver(
16641691 user_data_dir ,
16651692 extension_zip ,
16661693 extension_dir ,
1694+ disable_features ,
16671695 binary_location ,
16681696 driver_version ,
16691697 page_load_strategy ,
@@ -1784,6 +1812,7 @@ def get_remote_driver(
17841812 user_data_dir ,
17851813 extension_zip ,
17861814 extension_dir ,
1815+ disable_features ,
17871816 binary_location ,
17881817 driver_version ,
17891818 page_load_strategy ,
@@ -1955,6 +1984,7 @@ def get_remote_driver(
19551984 user_data_dir ,
19561985 extension_zip ,
19571986 extension_dir ,
1987+ disable_features ,
19581988 binary_location ,
19591989 driver_version ,
19601990 page_load_strategy ,
@@ -2075,6 +2105,7 @@ def get_local_driver(
20752105 user_data_dir ,
20762106 extension_zip ,
20772107 extension_dir ,
2108+ disable_features ,
20782109 binary_location ,
20792110 driver_version ,
20802111 page_load_strategy ,
@@ -2570,18 +2601,6 @@ def get_local_driver(
25702601 edge_options .add_argument (
25712602 "--disable-autofill-keyboard-accessory-view[8]"
25722603 )
2573- edge_options .add_argument ("--ash-no-nudges" )
2574- edge_options .add_argument ("--deny-permission-prompts" )
2575- if user_data_dir :
2576- edge_options .add_argument (
2577- "--disable-features=OptimizationHintsFetching,Translate,"
2578- "OptimizationTargetPrediction,PrivacySandboxSettings4"
2579- )
2580- else :
2581- edge_options .add_argument (
2582- "--disable-features=OptimizationHintsFetching,Translate,"
2583- "OptimizationTargetPrediction"
2584- )
25852604 edge_options .add_argument ("--disable-browser-side-navigation" )
25862605 edge_options .add_argument ("--disable-translate" )
25872606 if not enable_ws :
@@ -2596,6 +2615,12 @@ def get_local_driver(
25962615 if headless or headless2 or is_using_uc (undetectable , browser_name ):
25972616 edge_options .add_argument ("--disable-renderer-backgrounding" )
25982617 edge_options .add_argument ("--disable-backgrounding-occluded-windows" )
2618+ edge_options .add_argument ("--disable-client-side-phishing-detection" )
2619+ edge_options .add_argument ("--disable-oopr-debug-crash-dump" )
2620+ edge_options .add_argument ("--disable-top-sites" )
2621+ edge_options .add_argument ("--ash-no-nudges" )
2622+ edge_options .add_argument ("--no-crash-upload" )
2623+ edge_options .add_argument ("--deny-permission-prompts" )
25992624 if (
26002625 page_load_strategy
26012626 and page_load_strategy .lower () in ["eager" , "none" ]
@@ -2677,6 +2702,7 @@ def get_local_driver(
26772702 edge_options .add_argument ("--disable-gpu" )
26782703 if IS_LINUX :
26792704 edge_options .add_argument ("--disable-dev-shm-usage" )
2705+ extra_disabled_features = []
26802706 set_binary = False
26812707 if chromium_arg :
26822708 # Can be a comma-separated list of Chromium args
@@ -2690,8 +2716,33 @@ def get_local_driver(
26902716 chromium_arg_item = "--" + chromium_arg_item
26912717 if "set-binary" in chromium_arg_item :
26922718 set_binary = True
2719+ elif "disable-features=" in chromium_arg_item :
2720+ d_f = chromium_arg_item .split ("disable-features=" )[- 1 ]
2721+ extra_disabled_features .append (d_f )
26932722 elif len (chromium_arg_item ) >= 3 :
26942723 edge_options .add_argument (chromium_arg_item )
2724+ if disable_features :
2725+ extra_disabled_features .extend (disable_features .split ("," ))
2726+ included_disabled_features = []
2727+ if user_data_dir :
2728+ included_disabled_features .append ("OptimizationHintsFetching" )
2729+ included_disabled_features .append ("Translate" )
2730+ included_disabled_features .append ("OptimizationTargetPrediction" )
2731+ included_disabled_features .append ("PrivacySandboxSettings4" )
2732+ for item in extra_disabled_features :
2733+ if item not in included_disabled_features :
2734+ included_disabled_features .append (item )
2735+ d_f_string = "," .join (included_disabled_features )
2736+ edge_options .add_argument ("--disable-features=%s" % d_f_string )
2737+ else :
2738+ included_disabled_features .append ("OptimizationHintsFetching" )
2739+ included_disabled_features .append ("Translate" )
2740+ included_disabled_features .append ("OptimizationTargetPrediction" )
2741+ for item in extra_disabled_features :
2742+ if item not in included_disabled_features :
2743+ included_disabled_features .append (item )
2744+ d_f_string = "," .join (included_disabled_features )
2745+ edge_options .add_argument ("--disable-features=%s" % d_f_string )
26952746 if (set_binary or IS_LINUX ) and not binary_location :
26962747 br_app = "edge"
26972748 binary_loc = detect_b_ver .get_binary_location (br_app )
@@ -2831,6 +2882,7 @@ def get_local_driver(
28312882 user_data_dir ,
28322883 extension_zip ,
28332884 extension_dir ,
2885+ disable_features ,
28342886 binary_location ,
28352887 driver_version ,
28362888 page_load_strategy ,
@@ -3348,6 +3400,7 @@ def get_local_driver(
33483400 None , # user_data_dir
33493401 None , # extension_zip
33503402 None , # extension_dir
3403+ None , # disable_features
33513404 binary_location ,
33523405 driver_version ,
33533406 page_load_strategy ,
@@ -3565,6 +3618,7 @@ def get_local_driver(
35653618 None , # user_data_dir
35663619 None , # extension_zip
35673620 None , # extension_dir
3621+ None , # disable_features
35683622 binary_location ,
35693623 driver_version ,
35703624 page_load_strategy ,
0 commit comments