How to open MS Edge in Internet Explorer mode Using Selenium but using the default user profile?

105 views
Skip to first unread message

Sohrab T

unread,
Aug 22, 2022, 6:01:12 PM8/22/22
to Selenium Users

I am trying to open MS Edge in Internet Explorer mode using Selenium with the default user profile loaded.

profile.png

The following opens Edge in Internet Explorer mode but the user profile is not the default profile.


from selenium import webdriver 
import os 
import sys 
ieOptions = webdriver.IeOptions() 
pwd = os.path.dirname(sys.argv[0]) 
web_driver_path = os.path.join(pwd,'IEDriverServer.exe') 
msedge_user_profile = ('C:/Users/' + os.getlogin() + '/AppData/Local/Microsoft/Edge/User Data/')
ieOptions.add_additional_option('user-data-dir', msedge_user_profile) 
ieOptions.add_additional_option("profile-directory", "Profile 1")
ieOptions.to_capabilities()
ieOptions.attach_to_edge_chrome = True
ieOptions.edge_executable_path = ( 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')

Any help would be really appreciated.

Reply all
Reply to author
Forward
0 new messages