3

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?

0

2 Answers 2

4

You need to download the recommended version of IE Driver Server from this link then refer to the code below to use Edge IE mode in Selenium in Python:

from selenium import webdriver

ieOptions = webdriver.IeOptions()
ieOptions.add_additional_option("ie.edgechromium", True)
ieOptions.add_additional_option("ie.edgepath",'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')
driver = webdriver.Ie(executable_path='E:\webdriver\IEDriverServer.exe', options=ieOptions)

driver.maximize_window()
driver.get('https://www.google.com/')

Note: Change the paths in the code to your owns.

Result:

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

I tried the same thing but it opens internet explorer and no edge :/
0

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..."; 
}

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.