Command prompt popping up Devtools Timed out connecting to Chrome in Headless mode

73 views
Skip to first unread message

Mick P

unread,
Mar 25, 2020, 3:15:10 AM3/25/20
to Selenium Users
Any help would be greatly appreciated.

I'm trying to use my computer but it keeps popping up a command prompt with an error, even though it's not an error.

Is there any way to suppress this message, or redirect it somewhere that doesn't open up a command window?

Or, is there something I can do to fix the problem, even though the driver works fine, gets the data I need, but I can't work on my computer because closing popups is no way to live.

I'm using:
                options.AddArguments("headless");
I've tried:
                options.AddArguments("--log-level=3");

in fact I've tried so many options, such as:
                options.AddArguments("--no-sandbox");
                options.AddArguments("--disable-infobars");
                options.AddArguments("--disable-dev-shm-usage");
                options.AddArguments("--disable-browser-side-navigation");
                options.AddArguments("--disable-gpu");
                options.AddArguments("--disable-logging");

Can anyone help me here? I've googled everything I can find, and all I get is people saying it's not an error and that nobody has been able to get rid of the popup.

Thanks
       
ChromeDriver woes.png

Jim Evans

unread,
Mar 26, 2020, 7:38:31 AM3/26/20
to Selenium Users
Every response saying it’s not an error is exactly correct. Showing the command prompt is a deliberate design choice for the .NET bindings. There is some subset of users who exit the browser by calling driver.Close() instead of driver.Quit(). Using Close will exit the browser, but can leave the chromedriver process running, and the .NET maintainers decided that it would be better to explicitly show the process running so that the user doesn’t unknowingly leave abandoned chromedriver processes running.

Having said that, there is a way to hide the command prompt. Doing a web search on “hide command prompt selenium” yields a list of results that show how. What you want is something like the following:

ChromeDriverService service = ChromeDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;

// Set options as required
ChromeOptions options = new ChromeOptions()

IWebDriver driver = new ChromeDriver(service, options);

Mick P

unread,
Mar 27, 2020, 6:07:21 AM3/27/20
to Selenium Users
Thanks so much Jim, that helps a lot
Reply all
Reply to author
Forward
0 new messages