Starting a Session
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'
browser = Watir::Browser.new
to close the browser:
browser.close
By default Watir will open a Chrome Browser. To open other browsers, specify the one you want as the first argument:
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 after the browser argument
Watir::Browser.new :firefox, url: "http://#{the_grid_url}:4444/wd/hub"
Check out the Capabilities Guide for how you can both ensure that you are getting the session you want, and to specify how the browser should behave during the session.