Testing · watir

Watir — Basic Authentication window Handling


require ‘rubygems’
require ‘firewatir’
include FireWatir


#(Use next line instead of –>browser.goto(“http://website.com”) and entered username , password)

# (If the authentication window occurs any other pages then simply call that LINK URL with username,password like this.)


2 thoughts on “Watir — Basic Authentication window Handling

  1. When I use the method above I get a “Confirm” dialog box that says “You are about to log in to the site “” with the username “admin”.” The call to goto does not return until I click “ok”. Do you know how to get past this confirm dialog box? I’m using firewatir on ubuntu linux.

  2. Hi, I have coded your tip but I still get this window when trying to access a basic auth website

    the code is

    require 'rubygems'
    require 'firewatir'
    require 'nokogiri'
    include FireWatir
    browser = Firefox.new
    browser.select_list(:name, "report_type").set("Servicegroup(s)")
    browser.button(:value,"Continue to Step 2").click
    browser.select_list(:name, "servicegroup").set("WAP Service Group Ping - KPI HA")
    browser.button(:value,"Continue to Step 3").click
    browser.select_list(:name, "timeperiod").set("Last 31 Days")
    browser.button(:value,"Create Availability Report!").click
    page_html = Nokogiri::HTML.parse(browser.html)
    puts page_html.xpath("html/body/div[3]/table/tbody/tr[6]/td[2]").inner_text

    any tip? Thanks in advance 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s