Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My Selenium IE instance not loading for Users that are not administrators

I wrote an application in C# to automate logging on to a webpage.

It works perfectly whenever an Admin runs the executable. Whenever a non-admin runs the project, it's as if IEDriver.exe doesn't launch. There are no restrictions of launching IEDriver.exe from a group policy.

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);
}

when I uncomment the LibraryExtractionPath, IEDriver doesn't launch.

When I debug the code.

 Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

points to the correct location which is

D:\PathToFolder\Project1\bin\Debug\

I think the problem is that the clients (as non-admin) are unable to launch IEDriver.exe

UPDATE: Internet Explorer's Protected Mode is not disabled, which can prevent running IE Driver as a non-admin user. Can I disable it using C# code and IE service options?

like image 600
software is fun Avatar asked Aug 14 '15 12:08

software is fun


People also ask

Does selenium work with IE?

These are capabilities and features specific to Microsoft Internet Explorer browsers. As of June 2022, Selenium officially no longer supports standalone Internet Explorer. The Internet Explorer driver still supports running Microsoft Edge in “IE Compatibility Mode.”

Does Selenium support IE 11?

The Selenium Project will not remove support for IE 11 when it retires but we will not actively fix issues as we have done with previous versions of IE. The Microsoft Edge team have committed to supporting IE Mode in Edge until 2029 when support for Windows 10 is retired.


1 Answers

From the looks of the path you have supplied

D:\PathToFolder\Project1\bin\Debug\

You are trying to run the driver from where it hase been compiled by Visual Studio. There are a couple of reasons why this may not work.

When you setup and compiled the code in visual studio it would have created the debug folder ect and used the permissions of the current user. This means that that user and Admins may be able to access it but no body else. Or if this was done as an Admin it may only be accessible to admins.

Quiet often Visual Studio and other IDEs will also have a different working directory and compile the exe into different directories depending on what build options you have selected. For example release versus debug. What this means is that dll's ect used by the exe are not in the same diretory as the exe. When you run inside visual studio this isn't a problem as it set the correct working directory and sorts it all out for you. In your case it is probably not quiet that simple if this is part of the problem. What it might mean is that any requisite dll's ect might be installed and in the path for the Admin but not for normal users.

What this breaks down to is this is likely a path or permissions issue. I would suggest using something like Dependency walker to see what the of the exe are: http://www.dependencywalker.com/ and ensuring that all users can access them.

If you do this as a user that the program is not working for dependency walker will show you what dependencies are not being found.

like image 116
Darkcylde Avatar answered Nov 14 '22 23:11

Darkcylde