@@ -763,6 +763,7 @@ def _set_chrome_options(
763
763
user_data_dir ,
764
764
extension_zip ,
765
765
extension_dir ,
766
+ disable_features ,
766
767
binary_location ,
767
768
driver_version ,
768
769
page_load_strategy ,
@@ -1044,6 +1045,7 @@ def _set_chrome_options(
1044
1045
binary_loc = detect_b_ver .get_binary_location (br_app , True )
1045
1046
if os .path .exists (binary_loc ):
1046
1047
binary_location = binary_loc
1048
+ extra_disabled_features = []
1047
1049
if chromium_arg :
1048
1050
# Can be a comma-separated list of Chromium args
1049
1051
chromium_arg_list = chromium_arg .split ("," )
@@ -1069,8 +1071,13 @@ def _set_chrome_options(
1069
1071
)
1070
1072
if os .path .exists (binary_loc ):
1071
1073
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 )
1072
1077
elif len (chromium_arg_item ) >= 3 :
1073
1078
chrome_options .add_argument (chromium_arg_item )
1079
+ if disable_features :
1080
+ extra_disabled_features .extend (disable_features .split ("," ))
1074
1081
if devtools and not headless :
1075
1082
chrome_options .add_argument ("--auto-open-devtools-for-tabs" )
1076
1083
if user_agent :
@@ -1089,19 +1096,36 @@ def _set_chrome_options(
1089
1096
if headless or headless2 or is_using_uc (undetectable , browser_name ):
1090
1097
chrome_options .add_argument ("--disable-renderer-backgrounding" )
1091
1098
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" )
1092
1102
chrome_options .add_argument ("--ash-no-nudges" )
1103
+ chrome_options .add_argument ("--no-crash-upload" )
1093
1104
chrome_options .add_argument ("--deny-permission-prompts" )
1105
+ included_disabled_features = []
1094
1106
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 )
1100
1118
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 )
1105
1129
if (
1106
1130
is_using_uc (undetectable , browser_name )
1107
1131
and (
@@ -1338,6 +1362,7 @@ def get_driver(
1338
1362
user_data_dir = None ,
1339
1363
extension_zip = None ,
1340
1364
extension_dir = None ,
1365
+ disable_features = None ,
1341
1366
binary_location = None ,
1342
1367
driver_version = None ,
1343
1368
page_load_strategy = None ,
@@ -1550,6 +1575,7 @@ def get_driver(
1550
1575
user_data_dir ,
1551
1576
extension_zip ,
1552
1577
extension_dir ,
1578
+ disable_features ,
1553
1579
binary_location ,
1554
1580
driver_version ,
1555
1581
page_load_strategy ,
@@ -1605,6 +1631,7 @@ def get_driver(
1605
1631
user_data_dir ,
1606
1632
extension_zip ,
1607
1633
extension_dir ,
1634
+ disable_features ,
1608
1635
binary_location ,
1609
1636
driver_version ,
1610
1637
page_load_strategy ,
@@ -1664,6 +1691,7 @@ def get_remote_driver(
1664
1691
user_data_dir ,
1665
1692
extension_zip ,
1666
1693
extension_dir ,
1694
+ disable_features ,
1667
1695
binary_location ,
1668
1696
driver_version ,
1669
1697
page_load_strategy ,
@@ -1784,6 +1812,7 @@ def get_remote_driver(
1784
1812
user_data_dir ,
1785
1813
extension_zip ,
1786
1814
extension_dir ,
1815
+ disable_features ,
1787
1816
binary_location ,
1788
1817
driver_version ,
1789
1818
page_load_strategy ,
@@ -1955,6 +1984,7 @@ def get_remote_driver(
1955
1984
user_data_dir ,
1956
1985
extension_zip ,
1957
1986
extension_dir ,
1987
+ disable_features ,
1958
1988
binary_location ,
1959
1989
driver_version ,
1960
1990
page_load_strategy ,
@@ -2075,6 +2105,7 @@ def get_local_driver(
2075
2105
user_data_dir ,
2076
2106
extension_zip ,
2077
2107
extension_dir ,
2108
+ disable_features ,
2078
2109
binary_location ,
2079
2110
driver_version ,
2080
2111
page_load_strategy ,
@@ -2570,18 +2601,6 @@ def get_local_driver(
2570
2601
edge_options .add_argument (
2571
2602
"--disable-autofill-keyboard-accessory-view[8]"
2572
2603
)
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
- )
2585
2604
edge_options .add_argument ("--disable-browser-side-navigation" )
2586
2605
edge_options .add_argument ("--disable-translate" )
2587
2606
if not enable_ws :
@@ -2596,6 +2615,12 @@ def get_local_driver(
2596
2615
if headless or headless2 or is_using_uc (undetectable , browser_name ):
2597
2616
edge_options .add_argument ("--disable-renderer-backgrounding" )
2598
2617
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" )
2599
2624
if (
2600
2625
page_load_strategy
2601
2626
and page_load_strategy .lower () in ["eager" , "none" ]
@@ -2677,6 +2702,7 @@ def get_local_driver(
2677
2702
edge_options .add_argument ("--disable-gpu" )
2678
2703
if IS_LINUX :
2679
2704
edge_options .add_argument ("--disable-dev-shm-usage" )
2705
+ extra_disabled_features = []
2680
2706
set_binary = False
2681
2707
if chromium_arg :
2682
2708
# Can be a comma-separated list of Chromium args
@@ -2690,8 +2716,33 @@ def get_local_driver(
2690
2716
chromium_arg_item = "--" + chromium_arg_item
2691
2717
if "set-binary" in chromium_arg_item :
2692
2718
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 )
2693
2722
elif len (chromium_arg_item ) >= 3 :
2694
2723
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 )
2695
2746
if (set_binary or IS_LINUX ) and not binary_location :
2696
2747
br_app = "edge"
2697
2748
binary_loc = detect_b_ver .get_binary_location (br_app )
@@ -2831,6 +2882,7 @@ def get_local_driver(
2831
2882
user_data_dir ,
2832
2883
extension_zip ,
2833
2884
extension_dir ,
2885
+ disable_features ,
2834
2886
binary_location ,
2835
2887
driver_version ,
2836
2888
page_load_strategy ,
@@ -3348,6 +3400,7 @@ def get_local_driver(
3348
3400
None , # user_data_dir
3349
3401
None , # extension_zip
3350
3402
None , # extension_dir
3403
+ None , # disable_features
3351
3404
binary_location ,
3352
3405
driver_version ,
3353
3406
page_load_strategy ,
@@ -3565,6 +3618,7 @@ def get_local_driver(
3565
3618
None , # user_data_dir
3566
3619
None , # extension_zip
3567
3620
None , # extension_dir
3621
+ None , # disable_features
3568
3622
binary_location ,
3569
3623
driver_version ,
3570
3624
page_load_strategy ,
0 commit comments