0

I am trying to create an instance of IE browser via selenium, but it is unable to create the session.

I am getting the below error:

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.

Image showing Internet option.

All solution ask you to enable the the protected mode settings by clicking the checkbox in Internet Options -> security, but as you can see in the screenshot, I don't have the particular checkbox. I am currently not able to find a working solution for this.

P.s - Its working fine with other browsers. My use case is Internet Explorer, so I have to use it.

1 Answer 1

0

I used the below snippet of code to update the Zone settings. You can run it via cmd too.

I able to open the IE mode Edge browser now.

def modify_registry_settings():
    # Specify the registry keys for each zone
    zone_keys = [r"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0",
                  r"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1",
                  r"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2",
                  r"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3",
                  r"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4"]

# Disable protected mode for each zone
for zone_key in zone_keys:
   subprocess.run(["reg", "add", zone_key, "/v", "2500", "/t", "REG_DWORD", "/d", "0", "/f"])

# Modify the Registry settings
modify_registry_settings()```

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.