0

I am using Selenium PhantomJS. When my program starts it opens command prompt (cmd) which then turns on the browser and does everything I have programmed it to do.

According to this answer there is no way to hide the command prompt (until v2.4 gets released), so I want to ask if there is a way to at least start it minimized or maybe stop Windows from focusing it after it pops up.

I tried the following code to programmatically press Alt+Tab:

        IWebDriver driver = new PhantomJSDriver(); //this starts browser and opens cmd
        System.Windows.Forms.SendKeys.Send("%{TAB}");//alt+tab

Unfortunately this only freezes the mouse as if I am in endless loop until the program ends.

I am using Windows 7, VS2013.

Community
  • 1
  • 1
A Petrov
  • 417
  • 1
  • 9
  • 23
  • try to set focus through process http://stackoverflow.com/questions/2315561/correct-way-in-net-to-switch-the-focus-to-another-application or other solution to run in the background, try to google, the continuous integration runs his task in the background as service – Andrian Durlestean Feb 20 '14 at 07:36

1 Answers1

0

Well, the new version 2.40 is out, so here is the solution - https://stackoverflow.com/a/21949015/1115382 - credit goes to @Martin Su.

Community
  • 1
  • 1
A Petrov
  • 417
  • 1
  • 9
  • 23