Basic Browser Authentication

The easiest and most elegant way to handle basic browser authentication is to supply the username and password in the URL, bypassing the dialog altogether.

require 'watir-webdriver'
b = Watir::Browser.start 'http://admin:password@yourwebsite.com'

Example Basic Browser Authentication Dialog