You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用Java Selenium启动Edge浏览器的IE模式

Selenium C# 启动Edge浏览器IE模式实现方案

前置准备

  • 先通过NuGet安装Selenium.WebDriver、Selenium.WebDriver.IEDriver依赖包
  • 下载对应版本的IEDriverServer,解压到本地任意目录
  • 确保本地已安装Chromium内核的Edge浏览器,且已开启IE模式相关权限

完整实现代码

// 引入必要命名空间
using OpenQA.Selenium;
using OpenQA.Selenium.IE;

// 业务逻辑代码
// 替换为你本地IEDriverServer的实际存放目录
string ieDriverPath = @"D:\SG\Downloads\IEDriverServer_Win32_3.150.2";

InternetExplorerOptions ieOptions = new InternetExplorerOptions();
// 启用Edge Chromium IE模式
ieOptions.AddAdditionalCapability("ie.edgechromium", true);
// 替换为你本地Edge浏览器的实际安装路径
ieOptions.AddAdditionalCapability("ie.edgepath", @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe");

// 初始化驱动
IWebDriver driver = new InternetExplorerDriver(ieDriverPath, ieOptions);

注意事项

  • 使用前请先在Windows功能设置中开启Internet Explorer 11功能,否则IE模式无法正常启动
  • IEDriverServer的版本需要和你使用的Selenium版本匹配,建议选择3.141.0及以上的稳定版本
  • 首次启动前可手动打开Edge浏览器,访问edge://settings/defaultBrowser,将「允许在 Internet Explorer 模式下重新加载网站」设置为允许,避免权限拦截

内容的提问来源于stack exchange,提问作者Selvamuthukumar G

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.06 01:21:03