@@ -223,6 +223,8 @@ def _set_chrome_options(
223
223
chrome_options .add_argument ("--homepage=about:blank" )
224
224
chrome_options .add_argument ("--dns-prefetch-disable" )
225
225
chrome_options .add_argument ("--dom-automation" )
226
+ chrome_options .add_argument ("--disable-hang-monitor" )
227
+ chrome_options .add_argument ("--disable-prompt-on-repost" )
226
228
if not use_auto_ext : # (It's ON by default. Disable it when not wanted.)
227
229
chrome_options .add_experimental_option ("useAutomationExtension" , False )
228
230
if (settings .DISABLE_CSP_ON_CHROME or disable_csp ) and not headless :
@@ -695,9 +697,11 @@ def get_local_driver(
695
697
print ("\n Warning: msedgedriver not found. Installing now:" )
696
698
sb_install .main (override = "edgedriver" )
697
699
sys .argv = sys_args # Put back the original sys args
700
+ # For Microsoft Edge (Chromium) version 79 or lower
698
701
return webdriver .Chrome (executable_path = LOCAL_EDGEDRIVER ,
699
702
options = chrome_options )
700
703
except Exception :
704
+ # For Microsoft Edge (Chromium) version 80 or higher
701
705
from msedge .selenium_tools import Edge , EdgeOptions
702
706
if LOCAL_EDGEDRIVER and os .path .exists (LOCAL_EDGEDRIVER ):
703
707
try :
@@ -707,6 +711,18 @@ def get_local_driver(
707
711
" executable: %s" % e )
708
712
edge_options = EdgeOptions ()
709
713
edge_options .use_chromium = True
714
+ prefs = {
715
+ "download.default_directory" : downloads_path ,
716
+ "local_discovery.notifications_enabled" : False ,
717
+ "credentials_enable_service" : False ,
718
+ "profile" : {
719
+ "password_manager_enabled" : False
720
+ }
721
+ }
722
+ if block_images :
723
+ prefs ["profile.managed_default_content_settings.images" ] = 2
724
+ edge_options .add_experimental_option ("prefs" , prefs )
725
+ edge_options .add_experimental_option ("w3c" , True )
710
726
edge_options .add_experimental_option (
711
727
"useAutomationExtension" , False )
712
728
edge_options .add_experimental_option (
@@ -734,13 +750,36 @@ def get_local_driver(
734
750
edge_options .add_experimental_option (
735
751
"mobileEmulation" , emulator_settings )
736
752
edge_options .add_argument ("--enable-sync" )
753
+ edge_options .add_argument ("--disable-infobars" )
754
+ edge_options .add_argument ("--disable-save-password-bubble" )
755
+ edge_options .add_argument ("--disable-single-click-autofill" )
756
+ edge_options .add_argument ("--disable-translate" )
757
+ edge_options .add_argument ("--disable-web-security" )
758
+ edge_options .add_argument ("--homepage=about:blank" )
759
+ edge_options .add_argument ("--dns-prefetch-disable" )
760
+ edge_options .add_argument ("--dom-automation" )
761
+ edge_options .add_argument ("--disable-hang-monitor" )
762
+ edge_options .add_argument ("--disable-prompt-on-repost" )
737
763
if proxy_string :
738
- if proxy_auth :
739
- edge_options = _add_chrome_proxy_extension (
740
- edge_options , proxy_string , proxy_user , proxy_pass )
741
764
edge_options .add_argument ('--proxy-server=%s' % proxy_string )
765
+ edge_options .add_argument ("--test-type" )
766
+ edge_options .add_argument ("--log-level=3" )
767
+ edge_options .add_argument ("--no-first-run" )
768
+ edge_options .add_argument ("--ignore-certificate-errors" )
769
+ if devtools and not headless :
770
+ edge_options .add_argument ("--auto-open-devtools-for-tabs" )
771
+ edge_options .add_argument ("--allow-file-access-from-files" )
772
+ edge_options .add_argument ("--allow-insecure-localhost" )
773
+ edge_options .add_argument ("--allow-running-insecure-content" )
742
774
if user_agent :
743
775
edge_options .add_argument ("--user-agent=%s" % user_agent )
776
+ edge_options .add_argument ("--no-sandbox" )
777
+ if swiftshader :
778
+ edge_options .add_argument ("--use-gl=swiftshader" )
779
+ else :
780
+ edge_options .add_argument ("--disable-gpu" )
781
+ if "linux" in PLATFORM :
782
+ edge_options .add_argument ("--disable-dev-shm-usage" )
744
783
capabilities = edge_options .to_capabilities ()
745
784
capabilities ["platform" ] = ''
746
785
return Edge (
0 commit comments