I'm updating to version 2.40 and was looking at the change log. http://selenium.googlecode.com/git/dotnet/CHANGELOG

It says "Now provide an option to hide command prompt window for driver service executables (IEDriverServer.exe, chromedriver.exe, etc.) in .NET bindings."

I can't find what setting to use to make this happen. How do I do it?

  • How do I overload my edge driver() with DriverDirectory, DriverService and Options. Or how do I apply all three to my driver? So I'm doing this: ``` EdgeOptions options = new EdgeOptions(); options.AddArgument("headless"); EdgeDriverService myDriverService = new EdgeDriverService.CreateDefaultService(); myDriverService.HideCommandPromptWindow = true; EdgeDriver edgeDriver = new EdgeDriver(Setup.DirectoryPath, options); //Want to apply myDriverService //in here how would I apply a myDriverService to the method, there's no overload for Driver Directory, options and Driver Service, only Driver Di
    – dutoit077
    Apr 21 at 23:11

Yes, you can hide command prompt window now in Selenium 2.40.0. I was writing a blog article about this earlier, which you might want to have a look here.

Please note that hiding command prompt window is not recommended.


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

var driver = new ChromeDriver(driverService, new ChromeOptions());


var driverService = InternetExplorerDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;

var driver = new InternetExplorerDriver(driverService, new InternetExplorerOptions());


var driverService = PhantomJSDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;

var driver = new PhantomJSDriver(driverService);
  • Interesting that it is an option, even though it is not suggested. Do you know an acceptable use case for this?
    – AlignedDev
    Mar 5 '14 at 20:01
  • 1
    @Aligned: If someone is using Selenium to develop an application that runs on client's computer. So it is a good idea to hide command window. Otherwise for testing purposes, I can't think of any.
    – Yi Zeng
    Mar 5 '14 at 20:30
  • 2
    @Aligned It's an option because enough people who use the .NET bindings asked for it, even though the maintainer of the .NET bindings believes it to be a mistake to hide the window. If, for some reason, your WebDriver code fails, and incorrectly doesn't call the .Quit method, with the command prompt window showing, it's blatantly obvious there's an extra process running. With the command prompt window hidden, it's not obvious.
    – JimEvans
    Mar 26 '14 at 22:25
  • @YiZeng Is there any way to achieve this in Python ? Mar 19 '17 at 18:06
ChromeDriverService chromeservice = ChromeDriverService.CreateDefaultService();
   chromeservice.HideCommandPromptWindow = true; //hide console window
   ChromeDriver driver = new ChromeDriver(chromeservice);

   FirefoxDriverService firefoxservice = FirefoxDriverService.CreateDefaultService();
   firefoxservice.HideCommandPromptWindow = true; //hide console window
   FirefoxDriver driver = new FirefoxDriver(firefoxservice);

Several other Selenium tools

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.