Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

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);
share|improve this answer
    
Interesting that it is an option, even though it is not suggested. Do you know an acceptable use case for this? –  Aligned 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
FirefoxDriver driver = new FirefoxDriver(firefoxProfile); 
driver.Manage().Window.Size = new Size(200, 200); // Resize Window 
driver.Manage().Window.Position = new Point(-2000, 100); // Put the window outsite my current window 
share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

    
First, you need to put context in your answer - look at the other, accepted answer to this question to see a good example. Second, you haven't actually answered the question: all your code does is move the window offscreen - in most environments it will still appear on the task. Please update your answer to make it more useful. –  Kate Paulk Mar 31 at 11:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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