I have created a player which will automate chrome using selenium and ChromeDriver in C#. It\'s working fine.
Issue what I am facing is, when it creates an object fo
As an update to this question. Yes, you can hide command prompt window in Selenium 2.40.0 and up. Please note that hiding command prompt window is not recommended but you can do it. As the question refers to C# you do it with the next code:
ChromeDriver
var driverService = ChromeDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;
var driver = new ChromeDriver(driverService, new ChromeOptions());
InternetExplorerDriver
var driverService = InternetExplorerDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;
var driver = new InternetExplorerDriver(driverService, new InternetExplorerOptions());
PhantomJSDriver
var driverService = PhantomJSDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;
var driver = new PhantomJSDriver(driverService);
Yes, you need modify source code in WebDriver\DriverService.cs in Start()
; add:
this.driverServiceProcess.StartInfo.CreateNoWindow = true;
Modifying source code in WebDriver\DriverService.cs is not necessary for this in latest WebDriver. You just need to instantiate ChromeDriverService and set HideCommandPromptWindow to true and then instantiate ChromeDriver by that service and ChromeOptions. I am giving C# code example below
var chromeDriverService = ChromeDriverService.CreateDefaultService();
chromeDriverService.HideCommandPromptWindow = true;
return new ChromeDriver(chromeDriverService, new ChromeOptions());
No, there is no way to hide the console window of the chromedriver.exe in the .NET bindings without modifying the bindings source code. This is seen as a feature of the bindings, as it makes it very easy to see when your code hasn't correctly cleaned up the resources of the ChromeDriver, since the console window remains open. In the case of some other languages, if your code does not properly clean up the instance of ChromeDriver by calling the quit()
method on the WebDriver object, you can end up with a zombie chromedriver.exe process running on your machine.
This is possible now, using the headless option. Might not have been available then. Running Chrome Headless
Translated into C#, you can do this:
ChromeOptions options = new ChromeOptions();
options.AddArgument("headless");
ChromeDriver driver = new ChromeDriver(options);
Now the browser window is invisible, while the rest of the program stays the same.