Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the console in PhantomJS + Selenium?

I'm using PhantomJS + Selenium in my application. When I initialize PhantomJS, a console pops up on the screen. I would like to hide this console before it pops up. I have searched for an answer, and I found this:

 var service = PhantomJSDriverService.CreateDefaultService(Environment.CurrentDirectory);
            service.WebSecurity = false;
            service.HideCommandPromptWindow = true;
            var driver = new PhantomJSDriver(service);

The code above hides the console, but the problem is that when the console is hidden my Windows application loses the focus. So, it stops working while PhantomJS console is working. I need to hide the console and make my application work with PhantomJS at the same time.

Does anyone know how can I do that?

like image 614
Tiago Castro Avatar asked Oct 03 '14 01:10

Tiago Castro


1 Answers

I am using this thing all the time works fine.

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

var driver = new PhantomJSDriver(driverService);
like image 147
Evaldas B Avatar answered Oct 04 '22 22:10

Evaldas B