I am trying to open Ms Edge in Elevated Mode, but I am unable to do so. (Windows 11)
I have tried to open it manually too, but the Elevated option is always set to 'No'.
Image showing Edge Elevated Mode Status:
I have tried using the below options via selenium
admin_edge_options = webdriver.IeOptions()
admin_edge_options.use_chromium = True
admin_edge_options.add_argument('--ie-mode-test')
admin_edge_options.add_argument('--no-sandbox')
admin_edge_options.add_argument('--disable-gpu')
admin_edge_options.add_argument('--disable-software-rasterizer')
admin_edge_options.add_argument('--disable-dev-shm-usage')
admin_edge_options.add_argument('--disable-extensions')
driver = webdriver.Ie(options=admin_edge_options)
Manually I have tried
I tried to perform the same on another Machine (windows 10),facing the same issue.
My config. python 3.12 selenium 4.18.1
Edit 1: Added edge://version screenshot.
I test and search information and found that it's by design. For chromium-based browsers, it's not recommended to launch the browser Elevated for any reason, as it leads to potential security issues. For these reasons it has built in the behavior to automatically "de-elevate" the browser if it is launched as an administrator.
If you still want to open Edge with elevated privileges, you can try opening it with an administrator account and add --no-sandbox
flag to Edge. For example, logging in Windows with an administrator account and use the code below to open Edge in Selenium:
from selenium import webdriver
import time
admin_edge_options = webdriver.EdgeOptions()
admin_edge_options.add_argument('--no-sandbox')
driver = webdriver.Edge(options=admin_edge_options)
driver.get('https://bing.com')
time.sleep(25)
driver.quit()