小编NoS*_*ion的帖子

我的Selenium IE实例未加载非管理员用户

我在C#中编写了一个应用程序来自动登录到网页.

只要Admin运行可执行文件,它就能完美运行.每当非管理员运行项目时,就好像IEDriver.exe没有启动一样.从组策略启动IEDriver.exe没有任何限制.

private IWebDriver _driver;

public void SetUp()
{
        InternetExplorerOptions options = new InternetExplorerOptions();
        options.EnsureCleanSession = true;
        options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
        options.RequireWindowFocus = true;
        options.EnablePersistentHover = false;

        var service = InternetExplorerDriverService.CreateDefaultService();
        service.LibraryExtractionPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
        //service.HideCommandPromptWindow = true;

        _driver = new InternetExplorerDriver(service, options);
}
Run Code Online (Sandbox Code Playgroud)

当我取消注释LibraryExtractionPath时,IEDriver不会启动.

当我调试代码.

 Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
Run Code Online (Sandbox Code Playgroud)

指向正确的位置

d:\ PathToFolder\PROJECT1\BIN \调试\

我认为问题是客户端(非管理员)无法启动IEDriver.exe

更新:未禁用Internet Explorer的保护模式,这可能会阻止以非管理员用户身份运行IE驱动程序.我可以使用C#代码和IE服务选项禁用它吗?

c# selenium internet-explorer

7
推荐指数
1
解决办法
344
查看次数

标签 统计

c# ×1

internet-explorer ×1

selenium ×1