'Turn off remote debugging to open this site in internet explorer mode. Otherwise, it might not work as expected

I am trying to automate some workflow using selenium python on edge browser, I am stuck with the weird scenario.

When I run the selenium script, the Layout of the webpage displays like the Layout in the chrome browser(which is not compatible, Menu bar options shows Vertically) and also "Submit" button gets greyed out as soon as click on submit button. However, When I perform the same operation manually in the edge browser, it works fine (Menu bar options shows horizontally).

When I run the selenium script, I have noticed that an info bar is showing on the Edge browser that "Turn off remote debugging to open this site in internet explorer mode. Otherwise, it might not work as expected." Is remote debugging mode causing the issue? If so how would I turn it off? I have tried multiple posts in StackOverflow on this but did not find the solution. Please let me know if any other information is needed.

from selenium import webdriver
from selenium.webdriver.edge.service import Service

edge_options = webdriver.EdgeOptions()
edge_options.add_argument("user-data-dir=C:\\Users\\XYZ\\AppData\\Local\\Microsoft\\Edge\\User Data1")  
ser = Service("C:/Users/XYZ/ABC/msedgedriver.exe")    
edge_browser = webdriver.Edge(options = edge_options, service=ser)
edge_browser.maximize_window()
edge_browser.get("***Site URL***")

Note: Application is not compatible with chrome, firefox and etc. And works only on the edge and IE browsers and IE got decommissioned recently.

I believe the issue is only for the site which I am using as I have tested with other sites, they are working properly. And I could see info bar "Turn off remote debugging to open this site in internet explorer mode. Otherwise, it might not work as expected" for specific site only



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source