Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.7k 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 (62.9k points)
  1. Add 2 libraries via NuGet like the image shown below


2. Try below Code:

String url = "";

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!

28.4k questions

29.7k answers


94k users

Browse Categories