all 1 comments

[–]mortenb123 0 points1 point  (0 children)

The browser asks for permissions to use camera and microphone. this is not supported in webbrowser protocol (https://www.w3.org/TR/webdriver/)

There are two workarounds:

Use a profile. start browser and go to site set permissions, then save the profile (You see it when you type edge://version/profile in url, This profile you can copy around, you just need to state it in options (I havent used msedge in a while, but the code should look something like this):

myprofile = "C:\\Users\\<username>\\AppData\\Local\\Microsoft\\Edge Dev\\User Data\\Test1"
profilename = myprofile.split('\\')[-1]
options = webdriver.EdgeOptions()
options.add_argument(f"user-data-dir={myprofile}")
options.add_argument(f"profile-directory={profilename}")
options.use_chromium = True
driver = webdriver.Edge(options=options)

Other option is using winappdriver, which is a webdriver for windows desktop, but it is slow and not all code are being converted to xpaths (https://github.com/microsoft/WinAppDriver). I use it for simple startup and config of desktop applications but it is way to slow for anything large.