I got a website which is just compatible with Inte.net Explorer. We activated the Edge Inte.net Explorer Mode Option, but im unable to handle the website with Selenium. Is there any way to use IE-Mode with Edge in Selenium?
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:
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...";
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.