# Running Tests With the Browser Not Visible

**URL:** <https://www.ruby-forum.com/t/running-tests-with-the-browser-not-visible/68194>\
**Category:** Ruby\
**Created:** [September 10, 2006, 6:34am UTC](https://www.ruby-forum.com/t/running-tests-with-the-browser-not-visible/68194 "2006-09-10T06:34:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [September 10, 2006, 6:34am UTC](https://www.ruby-forum.com/t/running-tests-with-the-browser-not-visible/68194/1 "2006-09-10T06:34:14Z")

</div>

Rubies:

Unit tests should run as silent, fast, and unattended as possible. Even  
sick  
GUI tests.

So the page [http://wtr.rubyforge.org/watir\_user\_guide.html](http://wtr.rubyforge.org/watir_user_guide.html) contains this  
interesting line:

‘Run the tests with a “-b” option if you don’t want the browser to be  
visible. ex. myTest.rb -b’

Imagine my naivete, typing a -b onto the end of the command line  
invoking my  
test batch (using the standard Unit Test stuff under AutoRunner). The  
browsers still pop up.

How to suppress them from within the code?

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [September 10, 2006, 7:36am UTC](https://www.ruby-forum.com/t/running-tests-with-the-browser-not-visible/68194/2 "2006-09-10T07:36:17Z")

</div>

The -b will work IF you require watir first:

require ‘watir’  
require ‘test/unit’

Otherwise, test/unit will steal the arguments and not let watir have  
them.

Or, after the requires, do  
$HIDE\_IE = true

Bret

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [September 10, 2006, 9:27pm UTC](https://www.ruby-forum.com/t/running-tests-with-the-browser-not-visible/68194/3 "2006-09-10T21:27:26Z")

</div>

bpettichord wrote:

> Or, after the requires, do  
> $HIDE\_IE = true

It turns out this sets the wie.ie.Visible flag. So it’s the same as I  
had  
doing that. The window flashes as it paints, then hides itself.

This effect happens with both the in-process COM server and the with  
IE.new\_process() (which is otherwise working great; thanks!)

I thought that COM had a flag to pass into the object-creation muck to  
never  
display the window. And I know that CreateProcess[Ex], the heart of  
out-of-process creation, has one too.

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [September 10, 2006, 10:21pm UTC](https://www.ruby-forum.com/t/running-tests-with-the-browser-not-visible/68194/4 "2006-09-10T22:21:31Z")

</div>

On 9/10/06, Phlip [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> out-of-process creation, has one too.  
> This was a bug in 1.4. It is fixed in 1.5 when using the COM server –  
> at  
> least for me.

I don’t believe the IE.new\_process() code supports non-visible or -b at  
all  
in its current state. Feel free to supmit a patch.

Bret
