I have been trying to open Microsoft Edge in Internet Explorer mode using Selenium and have everytime encounted the following error:
"Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones."
My code is as following:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
ie_options = webdriver.IeOptions()
ie_options.attach_to_edge_chrome = True
ie_options.edge_executable_path = r"C:\Users\PC1\Downloads\IEDriverServer_Win32_4.14.0\IEDriverServer.exe"
driver = webdriver.Ie(options=ie_options)
driver.get("http://www.bing.com")
elem = driver.find_element(By.ID, 'sb_form_q')
elem.send_keys('WebDriver' + Keys.RETURN)
driver.quit()
I have tried changing the settings manually in internet explorer (although it seems that I cant change "Restricted Sites" to anything but High(default)) and I have also enabled "Protected Mode" in Group Policy Editor.
Does anyone have any experience troubleshooting this error or can help in any way?
I suggest that you can edit protected mode settings in registry. For the path of registry key, you can refer to this article. For example, here I disabled protected mode (set value to 3) for all zones (zone 1, 2, 3 ,4). You can refer to the picture below:
Besides, please note that you need to place the IEDriverServer executable in the PATH. For the required configuration of using IEDriver, please refer to this doc.
There are also some problems with the code you use. The
ie_options.edge_executable_pathshould point to the path of the Microsoft Edge executable. Please change the line of code like below: