Skip to content
MauravdL edited this page Sep 13, 2010 · 14 revisions

The following commands can be used in tests or in script\console

  • browser – access the browser
  • goto url – go to a url; url is relative to the base url.
  • site.config[:url] – returns the base url of the environment (see also Configuration Options)

These are two different ways of doing the same thing:

browser.goto site.config[:url]
goto ''

In addition, you can access any page; e.g. home_page will return an instance of HomePage. See Pages

Execution Contexts

These commands will work in any “execution context”. WatirCraft supplies several execution contexts:

  1. Inside an it block in an Rspec test
  2. Inside a before or after block in an Rspec test
  3. Inside a step definition for a Cucumber test
  4. At the script\console prompt (after irb START)
  5. Inside your initialize_browser method definition for your Site.
  6. Inside a project method
Clone this wiki locally