Logon
Logon

Reputation: 93

C# chrome driver only opening as background process on IIS / Windows Server 2016

I am running chromedriver on windows server 2016 with IIS, i have my test project installed and invoking it with an MVC5 API. That all seems fine but chromedriver and chrome.exe only seems to open as a background processes.

The same code opens these fine locally, i am not using any of the driver flags for headless browsing either. if i return the drive page source i can see that chromedriver went to google and returned the correct html in my API.

It just does not work for normal / non headless tests with google or our application.

        var driver = x.StartWebDriver();
        driver.Manage().Window.Maximize();
        driver.Navigate().GoToUrl("http://www.google.com");

        return driver.PageSource;

Any ideas?

Upvotes: 0

Views: 2115

Answers (2)

Sivaprakash D
Sivaprakash D

Reputation: 31

Open the chrome driver and note the port number(eg:5353)

In java:

System.setProperty(chromeDriverName, chromeDriverLocation);

ChromeOptions options = new ChromeOptions();

URL uri = new URL(chromeDriverPort);//http://localhost:5353

WebDriver driver = new RemoteWebDriver(uri, options);

your problem gets solved in is server.

Upvotes: 1

TUAN KIET LE
TUAN KIET LE

Reputation: 11

I have got the same issue and this is how I solve this:

  1. Open a command prompt and navigate to your ChromeDriver location.

  2. Execute chromedriver.exe and you will see the message as below. image here

    In the image above you see chrome driver is listening on port 9515.

  3. Now change your code as below, rebuild and call you api to execute your test.

    ChromeOptions options = new ChromeOptions();

    //set your chromeoptions here

    Uri uri = new Uri("http://localhost:**9515");

    _driver = new RemoteWebDriver(uri, options);

Upvotes: 1

Related Questions