Starting a Session

Edit on GitHub

Opening a Browser

Once you’ve installed Watir, and your desired drivers, and have an open irb session, you can try out opening a browser with:

require 'watir'
Watir::Browser.new

By default Watir will open a Chrome Browser.

To open other browsers:

Watir::Browser.new :firefox
Watir::Browser.new :internet_explorer
Watir::Browser.new :edge
Watir::Browser.new :safari

To open a browser on a remote machine, specify the url:

Watir::Browser.new :firefox, url: "http://#{the_grid_url}:4444/wd/hub"

There are many settings that can be customized on each browsers: