Tips and Tricks

Tips and Tricks

Running Tests With the Browser Not Visible

Run the tests with a -b option if you don't want the browser to be visible. Example:

my_test.rb -b

You can also hide the browser window without using the -b flag. Example:

$HIDE_IE = true
ie = Watir::IE.new()

Running a Test Concurrently

To run a test concurrently, check out concurrent_search.rb in the examples directory for an example.

How do I get the version numbers of Ruby and Watir?

Go to command prompt.

For the Watir version type:

ruby -e 'require "watir"; puts Watir::IE::VERSION'
    

For the Ruby version type:

ruby -v
    

How to keep command prompt window open after tests are finished?

Do not run your Watir script by double clicking it. Instead, open command prompt, navigate to folder where script is located and execute the script from there.

Glossary

Instance, an object that has been created for use by a program and is stored in memory.

Message, an action descriptor that can be sent to an object. If the object recognizes the message, it will respond and display related behavior.

Object, something that contains attributes and displays behavior according to what messages have been sent to it.

Ruby, object-oriented scripting language.

Watir, Web Application Testing in Ruby.

Feedback

Questions? Comments? The Watir development team like to hear your comments and suggestions for improvement. Email questions and suggestions to the Watir General Google group. Please read Support before posting.

The End

This is the end of the tutorial. Check out other pages at Watir Wiki. Watir unit tests are good resource.

Tutorial: the end
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.