Hide Browser Window?

639 views
Skip to first unread message

portaldev

unread,
Mar 22, 2009, 7:07:05 AM3/22/09
to webdriver
Hi,
I think WebDriver is excellent but...

Is there a way to hide the FireFox browser window using WebDriver?

Or even close the window after I have finished my script?

Or minimise?

Will I have to do by exec some OS command? (using XP and Linux)

Thanks.

Carlos Villela

unread,
Mar 22, 2009, 9:34:39 AM3/22/09
to webd...@googlegroups.com
On Linux, all you have to do is make it start in a different X
display. VNC servers are great for this, as you can still peek inside
if you suspect something is acting up.

No idea on Windows, but I have a suspicion it might work for Macs as well.

2009/3/22 portaldev <barry...@gmail.com>:

Mirko Nasato

unread,
Mar 22, 2009, 10:22:11 AM3/22/09
to webd...@googlegroups.com
To close the Firefox window after your tests finish you just need to call close() on the driver instance.

To run headless on Linux you can also use Xvfb.

Cheers

Mirko

2009/3/22 Carlos Villela <carlos....@gmail.com>

Simon Stewart

unread,
Mar 22, 2009, 1:05:43 PM3/22/09
to webd...@googlegroups.com
Hi,

Firefox itself doesn't have a handy mechanism for running "headless",
but as Carlos and Mirko suggest it's pretty easy to do on Linux. I'd
suggest calling "quit" on your webdriver instances in the tear down of
your tests. This will quit any open instances of webdriver, and will
close any open windows.

If you're using the InternetExplorerDriver, then you can the following
to cause IE to run in headless mode:

((InternetExplorerDriver) driver).setVisible(false);

Regards,

Simon

portaldev

unread,
Mar 22, 2009, 11:00:33 AM3/22/09
to webdriver
Great answers and very quick! Thanks very much Mirko and Carlos.


On Mar 22, 2:22 pm, Mirko Nasato <mirko.nas...@gmail.com> wrote:
> To close the Firefox window after your tests finish you just need to call
> close() on the driver instance.
>
> To run headless on Linux you can also use Xvfb.
>
> Cheers
>
> Mirko
>
> 2009/3/22 Carlos Villela <carlos.vill...@gmail.com>
>
>
>
> > On Linux, all you have to do is make it start in a different X
> > display. VNC servers are great for this, as you can still peek inside
> > if you suspect something is acting up.
>
> > No idea on Windows, but I have a suspicion it might work for Macs as well.
>
> > 2009/3/22 portaldev <barrybe...@gmail.com>:

portaldev

unread,
Mar 22, 2009, 6:14:36 PM3/22/09
to webdriver
quit works great - thanks! and Xvfb is very useful too.
Reply all
Reply to author
Forward
0 new messages