Selenium automation report Protected Mode settings are not the same for all zones. Solution

selenium.common.exceptions.SessionNotCreatedException: 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.

Process finished with exit code 1

For win11, the internet option does not enable the protected mode check box

If the protected mode is not enabled for win11 , we cannot use the Internet option settings to solve the error reporting problem. We can add a few lines of code to the python automation code implementation to solve it, as follows:

#Define an ie options first

options=webdriver.IeOptions()

#Ignore protected mode set to true

options.ignore_protected_mode_settings=True

#Put options in when defining the driver

driver=webdriver.Ie(executable_path="D:\Python\Python36\IEDriverServer.exe",options=options)

Guess you like

Origin blog.csdn.net/u012388338/article/details/129619082