cheat · cheat sheet · QA · Ruby 1.9 · ruby excercise · watir · watir-webdriver

Watir-webdriver cheatsheet

Getting Started

Load the Watir Webdriver library

require 'watir-webdriver'

Open a browser (Ex: Internet Explorer)

driver = :ie

Go to a specified URL

driver.goto ''

Close the browser


Access an Element

Type something in the Text box or text area


To Clear the text from text field 



To click the button

Drop down list

To select the value from list
driver.select_list(:id,'airStartTime').select("1 am")

To get the selected value from select field

Check box

To clik the check box

To know the clicked? or not ?

Radio button,'htlChoice').click

To verify Flights radio button selected or not,'htlChoice').set?

#if it returns TRUE then radio button already selected.

To get the title of the webpage puts driver.title

Return true if the specified text appears on the TAG

 puts,'welcomeText').text.include("Welcome to Orbitz")

To Click SPAN Elements driver.span(:text,'Find Flights').click

2 thoughts on “Watir-webdriver cheatsheet

    1. Hi Chuckvdl, Thanks for your valuable Comment. But WordPress not giving the multiple Color text option for Free WordPress Users. So I have bloded the codes.

      Sorry for the inconveninece.

Leave a Reply

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

You are commenting using your 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