!!

Welcome to Selenium Webdriver Forum

As a web user you can read and search through forum content. Once you have registered and signed you can post topics, post replies, set up watch lists, modify forum settings, and use private messaging.

Author Topic: Hide Browser Window?  (Read 4151 times)

portaldev

  • Web User
Hide Browser Window?
« on: February 23, 2012, 02:04:09 PM »
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

  • Web User
Re: Hide Browser Window?
« Reply #1 on: February 23, 2012, 02:04:23 PM »
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>:
 

- Show quoted text -

Mirko Nasato

  • Web User
Re: Hide Browser Window?
« Reply #2 on: February 23, 2012, 02:04:31 PM »
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>
 

- Show quoted text -

Selenium Webdriver

Re: Hide Browser Window?
« Reply #2 on: February 23, 2012, 02:04:31 PM »

Simon Stewart

  • Web User
Re: Hide Browser Window?
« Reply #3 on: February 23, 2012, 02:04:39 PM »
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
 

- Show quoted text -

portaldev

  • Web User
Re: Hide Browser Window?
« Reply #4 on: February 23, 2012, 02:04:48 PM »
Great answers and very quick!   Thanks very much Mirko and Carlos.
 On Mar 22, 2:22 pm, Mirko Nasato <mirko.nas...@gmail.com> wrote:
 

- Show quoted text -

portaldev

  • Web User
Re: Hide Browser Window?
« Reply #5 on: February 23, 2012, 02:04:56 PM »
quit works great - thanks!  and Xvfb is very useful too.

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
1817 Views
Last post March 28, 2012, 06:36:21 PM
by Danny Leblond
3 Replies
992 Views
Last post April 01, 2012, 08:36:26 PM
by Deep blue -Tian
7 Replies
1659 Views
Last post April 11, 2012, 05:49:52 PM
by shen xieyin
0 Replies
1434 Views
Last post April 25, 2012, 03:30:31 PM
by Selenium Webdriver Admin
2 Replies
600 Views
Last post May 09, 2012, 10:31:03 PM
by ahsyed@corelogic.com
2 Replies
2574 Views
Last post July 25, 2012, 08:54:12 PM
by Testing_SSC
5 Replies
1168 Views
Last post September 25, 2012, 11:19:27 AM
by austenjt