Home > Mobile >  Python Selenium Edge Browser in Internet Explorer mode
Python Selenium Edge Browser in Internet Explorer mode

Time:09-18

I got a website which is just compatible with Internet Explorer. We activated the Edge Internet Explorer Mode Option, but im unable to handle the website with Selenium. Is there any way to use IE-Mode with Edge in Selenium?

CodePudding user response:

You need to download the recommended version of IE Driver Server from enter image description here

CodePudding user response:

at the moment there is no Edge browser IE Mode option for Python but there is an option in C#

if you are familiar with C# you can follow steps below

Download the latest version of IEDriverServer from the Selenium site.

Create a C# console project using Visual Studio.

Install Selenium.WebDriver 3.141.0 NuGet package from Nuget package manager.

Add the code below to the project and modify the paths.

static void Main(string[] args) 
{ 
    var dir = "{FULL_PATH_TO_IEDRIVERSERVER}"; 
    var driver = "IEDriverServer.exe"; 
    if (!Directory.Exists(dir) || !File.Exists(Path.Combine(dir, driver))) 
    { 
        Console.WriteLine("Failed to find {0} in {1} folder.", dir, driver); 
        return; 
    } 

    var ieService = InternetExplorerDriverService.CreateDefaultService(dir, driver); 
    var ieOptions = new InternetExplorerOptions{}; 
    ieOptions.AddAdditionalCapability("ie.edgechromium", true); 
    ieOptions.AddAdditionalCapability("ie.edgepath", "{FULL_PATH_TO_MSEDGE.EXE}"); 

    var webdriver = new InternetExplorerDriver(ieService, ieOptions, TimeSpan.FromSeconds(30)); 
    webdriver.Url = "http://Your_Site_URL_here..."; 
}
  • Related