0 votes
1 view
in Devops and Agile by (19.8k points)

I want to try out headless chrome, but I am running into this issue, that I can't start the driver in headless mode. I was following google documentation. am I missing something? The code execution gets stuck in var browser = new ChromeDriver(); line

Here is my code:

var chromeOptions = new ChromeOptions


    BinaryLocation = @"C:\Users\2-as Aukstas\Documents\Visual Studio 2017\Projects\ChromeTest\ChromeTest\bin\Debug\chromedriver.exe",

    DebuggerAddress = "localhost:9222"


chromeOptions.AddArguments(new List<string>() {"headless", "disable-gpu" });

var browser = new ChromeDriver(chromeOptions);



1 Answer

0 votes
by (63.4k points)
  1. Add 2 libraries via NuGet like the image shown below


2. Try below Code:

String url = "http://www.google.com";

var chromeOptions = new ChromeOptions();

chromeOptions.AddArguments(new List<string>() { "headless" });

var chromeDriverService = ChromeDriverService.CreateDefaultService();

ChromeDriver driver = new ChromeDriver(chromeDriverService, chromeOptions);


Welcome to Intellipaat Community. Get your technical queries answered by top developers !