SlideShare a Scribd company logo
Introduction to Ruby-Watir
PRESENTED BY: SUBHASISH PATTANAIK
SOFTWARE QUALITY ANALYST
MINDFIRE SOLUTIONS
Contents

What is Watir?

What WATIR is not...

What is Ruby?

How does Watir works?

Why Watir?

Setting up WATIR

Learning WATIR

IDE's for Ruby-Watir

Small Scripts
What is WATIR?

Web Application Testing In Ruby

It is a library for the Ruby language which drives Firefox,
Google Chrome, Internet Explorer the same way people
do;

clicks links,

fills in forms,

and presses buttons.

Watir can also check results, such as whether expected
text appears on the page.

It can be used to test all types of web applications
(ASP.Net, JSP, PHP, Rails, etc…)

Open Source – written by Bret Pettichord, Paul Rogers and
many other contributors.
What WATIR is not...

Watir is not a record/playback tool.

However, there are several recorders “out there”

WatirMaker

Watir WebRecorder

Webmetrics RIA Script Recorder (most recent discussion…they
are considering open sourcing their application)

Watir is not a link checker.

However, you can easily write your own link checker and customize
it to your specific needs.

Watir is not a test case management tool.

However, you can write one in Ruby if desired.

Doesn’t test Flash or Applets.
What is Ruby?

Full featured Object Oriented scripting language

Made “famous” for it’s web application framework Rails. (Ruby on
Rails)

Interpreted rather than compiled

Written by Matz (Yukihiro Matsumoto)

Started in 1994

Written in C

Will work on any platform that has a C compiler

Windows

Linux
How does Watir works?

Uses the COM interface of Internet Explorer (IE)

Allows an external program to control IE

Similar interfaces exist for Word, Excel, PowerPoint and Outlook.

Full access to the contents of an HTML page

Provides different ways to access objects
The Big Question :
Why Watir?
Why Watir? (contd...)

As a testing tool: It’s as robust & sophisticated as
‘professional’ tools such as Rational, Mercury & Segue.

As a library of a programming language [Ruby ] : It’s powerful.

(You have the power to connect to databases, read data files,
export XML, structure your code into reusable libraries, and
pretty much anything else you can think of…)

No “Vendor-script”

It’s simple – elegant – INTUITIVE

It has a supportive online community for when you get ‘stuck’.
Setting up WATIR
Learning WATIR :
Getting Started
As you start to get into Ruby/Watir you’ll want some Good
information at your fingertips!
Introductory Documentation:

Watir homepage: http://watir.com

Watir User Guide: http://en.wikipedia.org/wiki/watir
Books:

Everyday Scripting with Ruby: for Teams, Testers, and You:
http://pragprog.com/book/bmsft/everyday-scripting-with-ruby

Programming Ruby (Online Book): http://ruby-
doc.com/docs/ProgrammingRuby/
Learning WATIR :
More In-Depth
Forums:

Watir General Forum (now on Google Groups):
http://groups.google.com/group/watir-general?hl=en

Watir Search (web interface that searches 7 Watir sites):
https://www.google.com/cse/home?
cx=007267089725385613265:gmydx5gtw6u

Online Ruby Information: http://www.ruby-doc.org/

Watir Book : https://github.com/watir/watirbook
Development
Environment's(IDE's)
for Ruby
Use any text editor as an IDE:

ScITE (Free)

Included with your ruby download.

Notepad ++(Free)

Eclipse (using RDT Plugin)

http://rubyeclipse.sourceforge.net/

Ruby In Steel (Free - $199) (Add-on to VS.Net )

http://www.sapphiresteel.com

Komodo IDE ($295) / Komodo Edit (Free)

http://www.activestate.com
Using Ruby's
Interactive Command
Interpreter (IRB)

What is it?

Interactive Ruby.

It evaluates Ruby expressions from the Terminal.

Used To:

Run quick experiments to see if things will work in your tests
– irb (main) : 001 : 0> require 'watir'.
– irb (main) : 002 : 0> require 'watir-webdriver'.
– irb (main) : 003 : 0> browser = Watir::Browser.new'.
– irb (main) : 004 : 0> browser.goto 'http://google.com'
Let's Get Started..
It’s time to turn on
the Watir!
Anatomy of Watir
Script
# Loads the watir gems
require 'watir'
# Loads all the gems required to drive firefox and chrome
require 'watir-webdriver'
# To open a new browser(firefox)
browser = Watir::Browser.new :firefox
# Navigate to the below URL
browser.goto 'http://ourgoalplan.com/'
# Identify the field to which data is to be inserted and enter the value
browser.text_field(:name => 'txtName').set 'subhasish.pattanaik'
browser.text_field(:name => 'txtPassword').set 'subh_2727'
# To click the button
browser.button( :id => 'btnLogin').click
# To enter the goals in the Text area
browser.text_field( :id => 'ucAddGoal_txtAddGoal').set '[CIRRATA-
WP] : TESTING + ISSUES REPORTING[EST - 2HRS]' + "n" +
'[COMMETTE] : TESTING + ISSUES REPORTING[EST - 2HRS]'
# To click on the Add Goal button
browser.button( :id => 'ucAddGoal_btnAddGoal').click
Use Watir

Using Watir API is very easy.

Reference the Watir API using the keyword 'require' and start
coding.
require 'watir'
require 'watir-webdriver'
browser = Watir::Browser.new :firefox
Web Pages are all
about Objects

Web pages are developed with objects:

Links, buttons, tables, drop-down boxes, forms, frames, etc.

Watir scripts need to access these objects &
manipulate them just as a user would.

Clicking, submitting, typing, selecting, etc…
Manipulating Web Page
Objects:Link
Manipulating Web Page
Objects:Checkbox
Manipulating Web Page
Objects:Radio Buttons
Manipulating Web Page
Objects:Selection Boxes
Manipulating Web Page
Objects:Text Fields
Manipulating Web Page
Objects:Buttons
A Closer Look... at the
structure
browser.button(:value, "Click
Me").click
[Variable] . [method] (: [element] , “ [unique identifier]” . [method]
Test Automation is
MORE than Identifying
Objects

Identifying objects is currently the most time
consuming part of creating your test scripts…

However, after your objects have been identified
& manipulated: you want to “Test” them!

You’ll want to create “PASS” or “FAIL”
scenarios.
…This is the most sophisticated part
of your scripts. Will learn more on this
in next seminar...
Congratulations!
You are on your Way
…to programming the Ruby-Watir way !!
References
1. https://github.com/watir/watirbook
2. http://watir.com/
3. http://watir.com/examples/
4. http://www.thoughtworks.com/insights/articles/automated-
testing-using-ruby-and-watir
5. http://watirwebdriver.com/
6. http://www.rubywatir.com/
7. http://en.wikipedia.org/wiki/Watir
Thank You
Any Queries???
Introduction To Ruby Watir (Web Application Testing In Ruby)

More Related Content

PPTX
Internship full stack developer ppt report .pptx
AnkitaVerma776806
 
PPTX
WORDPRESS
Akhil Kumar
 
PPT
What Is Php
AVC
 
PPTX
FYBSC IT Web Programming Unit IV PHP and MySQL
Arti Parab Academics
 
PDF
The Integration of Laravel with Swoole
Albert Chen
 
PPTX
Web application framework
Pankaj Chand
 
PPT
Java script final presentation
Adhoura Academy
 
PPT
Maven Overview
FastConnect
 
Internship full stack developer ppt report .pptx
AnkitaVerma776806
 
WORDPRESS
Akhil Kumar
 
What Is Php
AVC
 
FYBSC IT Web Programming Unit IV PHP and MySQL
Arti Parab Academics
 
The Integration of Laravel with Swoole
Albert Chen
 
Web application framework
Pankaj Chand
 
Java script final presentation
Adhoura Academy
 
Maven Overview
FastConnect
 

What's hot (20)

PDF
Burp suite
hamdi_sevben
 
PPTX
Inroduction to Latex
Swati Srivastava
 
PDF
.NET 7 家族新成員: Microsoft Orleans v7
twMVC
 
PPSX
Sessions and cookies
www.netgains.org
 
PPTX
Express JS Rest API Tutorial
Simplilearn
 
PPTX
PHP Cookies and Sessions
Nisa Soomro
 
PPTX
Php technical presentation
dharmendra kumar dhakar
 
PDF
Useful Linux and Unix commands handbook
Wave Digitech
 
DOC
Internet programming notes
Durgadevi palani
 
PDF
Troubleshooting Apache Cloudstack
Radhika Puthiyetath
 
PDF
Object Oriented Programming with Laravel - Session 1
Shahrzad Peyman
 
PDF
RESTful Web Services
Christopher Bartling
 
PPTX
web intership ritesh.pptx
Jenaj2
 
PPTX
HTML
Akash Varaiya
 
PDF
Unicode文字プロパティ
Shozo Hatta
 
PDF
Laravel Introduction
Ahmad Shah Hafizan Hamidin
 
PPT
IIS
Giritharan V
 
PPTX
Skills for Python Full Stack Developer.pptx
FirstBitSolutions
 
PDF
Swoole Love PHP
Yi-Feng Tzeng
 
Burp suite
hamdi_sevben
 
Inroduction to Latex
Swati Srivastava
 
.NET 7 家族新成員: Microsoft Orleans v7
twMVC
 
Sessions and cookies
www.netgains.org
 
Express JS Rest API Tutorial
Simplilearn
 
PHP Cookies and Sessions
Nisa Soomro
 
Php technical presentation
dharmendra kumar dhakar
 
Useful Linux and Unix commands handbook
Wave Digitech
 
Internet programming notes
Durgadevi palani
 
Troubleshooting Apache Cloudstack
Radhika Puthiyetath
 
Object Oriented Programming with Laravel - Session 1
Shahrzad Peyman
 
RESTful Web Services
Christopher Bartling
 
web intership ritesh.pptx
Jenaj2
 
Unicode文字プロパティ
Shozo Hatta
 
Laravel Introduction
Ahmad Shah Hafizan Hamidin
 
Skills for Python Full Stack Developer.pptx
FirstBitSolutions
 
Swoole Love PHP
Yi-Feng Tzeng
 
Ad

Viewers also liked (11)

PPT
Automated Testing With Watir
Timothy Fisher
 
PDF
Automated Testing with Ruby
Keith Pitty
 
PPT
Watir
Sai Venkat
 
PPT
What you can do In WatiR
Wesley Chen
 
PDF
watir-webdriver
jariba
 
PPT
Watir Presentation Sumanth Krishna. A
Sumanth krishna
 
PPTX
FOSDEM2016 - Ruby and OMR
Charlie Gracie
 
DOC
Selenium Automation Using Ruby
Kumari Warsha Goel
 
PPT
Keyword Driven Framework using WATIR
Nivetha Padmanaban
 
PDF
프로그래머로 부터 배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)
Mayuko Sekiya
 
PDF
Introduction to Selenium and Ruby
Ynon Perek
 
Automated Testing With Watir
Timothy Fisher
 
Automated Testing with Ruby
Keith Pitty
 
Watir
Sai Venkat
 
What you can do In WatiR
Wesley Chen
 
watir-webdriver
jariba
 
Watir Presentation Sumanth Krishna. A
Sumanth krishna
 
FOSDEM2016 - Ruby and OMR
Charlie Gracie
 
Selenium Automation Using Ruby
Kumari Warsha Goel
 
Keyword Driven Framework using WATIR
Nivetha Padmanaban
 
프로그래머로 부터 배우는 코딩 기술 (プログラマから学ぶコーディングテクニック)
Mayuko Sekiya
 
Introduction to Selenium and Ruby
Ynon Perek
 
Ad

Similar to Introduction To Ruby Watir (Web Application Testing In Ruby) (20)

PPTX
Test Automation using Ruby
Sla Va
 
PPTX
Page object from the ground up.ppt
Joseph Beale
 
PPTX
Page object from the ground up by Joe Beale
QA or the Highway
 
PPTX
Watir The Beginning
automated-testing.info
 
PPT
Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...
Sla Va
 
PPTX
Watir - The Beginning
Andrii Dzynia
 
PPTX
Cross Browser Automation Testing Using Watir
Sarah Elson
 
PDF
Espremendo melancia | TDC2014 Floripa | Chaordic
Carlos Tadeu Panato Junior
 
PDF
Espremendo melancia | TDC2014 Floripa | Chaordic
Chaordic
 
PDF
ruby pentest
testgmailnormal
 
PPTX
Cucumber From the Ground Up - Joseph Beale
QA or the Highway
 
PPT
Jonas Skjoldan - Automatic GUI test with Ruby and Watir
TEST Huddle
 
PDF
I'm watir
yidiyu
 
PPT
FireWatir - Web Application Testing Using Ruby and Firefox
angrez
 
PPT
watir-webdriver
Amit DEWAN
 
PDF
0201710897
guru50
 
PDF
Ruby tutorial
knoppix
 
PDF
Ruby Presentation
platico_dev
 
PDF
Workin On The Rails Road
RubyOnRails_dude
 
PPTX
Ruby And Ruby On Rails
AkNirojan
 
Test Automation using Ruby
Sla Va
 
Page object from the ground up.ppt
Joseph Beale
 
Page object from the ground up by Joe Beale
QA or the Highway
 
Watir The Beginning
automated-testing.info
 
Test Automation using Ruby, Watir, Rspec and AutoIT for GAMESCALE products te...
Sla Va
 
Watir - The Beginning
Andrii Dzynia
 
Cross Browser Automation Testing Using Watir
Sarah Elson
 
Espremendo melancia | TDC2014 Floripa | Chaordic
Carlos Tadeu Panato Junior
 
Espremendo melancia | TDC2014 Floripa | Chaordic
Chaordic
 
ruby pentest
testgmailnormal
 
Cucumber From the Ground Up - Joseph Beale
QA or the Highway
 
Jonas Skjoldan - Automatic GUI test with Ruby and Watir
TEST Huddle
 
I'm watir
yidiyu
 
FireWatir - Web Application Testing Using Ruby and Firefox
angrez
 
watir-webdriver
Amit DEWAN
 
0201710897
guru50
 
Ruby tutorial
knoppix
 
Ruby Presentation
platico_dev
 
Workin On The Rails Road
RubyOnRails_dude
 
Ruby And Ruby On Rails
AkNirojan
 

More from Mindfire Solutions (20)

PDF
Physician Search and Review
Mindfire Solutions
 
PDF
diet management app
Mindfire Solutions
 
PDF
Business Technology Solution
Mindfire Solutions
 
PDF
Remote Health Monitoring
Mindfire Solutions
 
PDF
Influencer Marketing Solution
Mindfire Solutions
 
PPT
High Availability of Azure Applications
Mindfire Solutions
 
PPTX
IOT Hands On
Mindfire Solutions
 
PPTX
Glimpse of Loops Vs Set
Mindfire Solutions
 
ODP
Oracle Sql Developer-Getting Started
Mindfire Solutions
 
PPT
Adaptive Layout In iOS 8
Mindfire Solutions
 
PPT
Introduction to Auto-layout : iOS/Mac
Mindfire Solutions
 
PPT
LINQPad - utility Tool
Mindfire Solutions
 
PPT
Get started with watch kit development
Mindfire Solutions
 
PPTX
Swift vs Objective-C
Mindfire Solutions
 
ODP
Material Design in Android
Mindfire Solutions
 
ODP
Introduction to OData
Mindfire Solutions
 
PPT
Ext js Part 2- MVC
Mindfire Solutions
 
PPT
ExtJs Basic Part-1
Mindfire Solutions
 
PPT
Spring Security Introduction
Mindfire Solutions
 
Physician Search and Review
Mindfire Solutions
 
diet management app
Mindfire Solutions
 
Business Technology Solution
Mindfire Solutions
 
Remote Health Monitoring
Mindfire Solutions
 
Influencer Marketing Solution
Mindfire Solutions
 
High Availability of Azure Applications
Mindfire Solutions
 
IOT Hands On
Mindfire Solutions
 
Glimpse of Loops Vs Set
Mindfire Solutions
 
Oracle Sql Developer-Getting Started
Mindfire Solutions
 
Adaptive Layout In iOS 8
Mindfire Solutions
 
Introduction to Auto-layout : iOS/Mac
Mindfire Solutions
 
LINQPad - utility Tool
Mindfire Solutions
 
Get started with watch kit development
Mindfire Solutions
 
Swift vs Objective-C
Mindfire Solutions
 
Material Design in Android
Mindfire Solutions
 
Introduction to OData
Mindfire Solutions
 
Ext js Part 2- MVC
Mindfire Solutions
 
ExtJs Basic Part-1
Mindfire Solutions
 
Spring Security Introduction
Mindfire Solutions
 

Recently uploaded (20)

PDF
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
PPTX
Materi_Pemrograman_Komputer-Looping.pptx
RanuFajar1
 
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Q-Advise
 
PDF
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
PDF
Why Should Businesses Extract Cuisine Types Data from Multiple U.S. Food Apps...
devilbrown689
 
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
PDF
The Future of Smart Factories Why Embedded Analytics Leads the Way
Varsha Nayak
 
PPTX
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
Tier1 app
 
DOCX
The Five Best AI Cover Tools in 2025.docx
aivoicelabofficial
 
PDF
Rise With SAP partner in Mumbai.........
pts464036
 
PPT
Order to Cash Lifecycle Overview R12 .ppt
nbvreddy229
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PPT
FALLSEM2025-26_ISWE304L_TH_VL2025260102786_2025-07-10_Reference-Material-II.ppt
AKSHAYA255427
 
PPTX
introduction to dart --- Section one .pptx
marknaiem92
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPT
Overview of Oracle Receivables Process.ppt
nbvreddy229
 
PPTX
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
PPTX
Hire Expert Blazor Developers | Scalable Solutions by OnestopDA
OnestopDA
 
PPTX
Audio Editing and it's techniques in computer graphics.pptx
fosterbayirinia3
 
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
Materi_Pemrograman_Komputer-Looping.pptx
RanuFajar1
 
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Q-Advise
 
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
Why Should Businesses Extract Cuisine Types Data from Multiple U.S. Food Apps...
devilbrown689
 
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
The Future of Smart Factories Why Embedded Analytics Leads the Way
Varsha Nayak
 
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
Tier1 app
 
The Five Best AI Cover Tools in 2025.docx
aivoicelabofficial
 
Rise With SAP partner in Mumbai.........
pts464036
 
Order to Cash Lifecycle Overview R12 .ppt
nbvreddy229
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
FALLSEM2025-26_ISWE304L_TH_VL2025260102786_2025-07-10_Reference-Material-II.ppt
AKSHAYA255427
 
introduction to dart --- Section one .pptx
marknaiem92
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Overview of Oracle Receivables Process.ppt
nbvreddy229
 
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
Hire Expert Blazor Developers | Scalable Solutions by OnestopDA
OnestopDA
 
Audio Editing and it's techniques in computer graphics.pptx
fosterbayirinia3
 

Introduction To Ruby Watir (Web Application Testing In Ruby)

  • 1. Introduction to Ruby-Watir PRESENTED BY: SUBHASISH PATTANAIK SOFTWARE QUALITY ANALYST MINDFIRE SOLUTIONS
  • 2. Contents  What is Watir?  What WATIR is not...  What is Ruby?  How does Watir works?  Why Watir?  Setting up WATIR  Learning WATIR  IDE's for Ruby-Watir  Small Scripts
  • 3. What is WATIR?  Web Application Testing In Ruby  It is a library for the Ruby language which drives Firefox, Google Chrome, Internet Explorer the same way people do;  clicks links,  fills in forms,  and presses buttons.  Watir can also check results, such as whether expected text appears on the page.  It can be used to test all types of web applications (ASP.Net, JSP, PHP, Rails, etc…)  Open Source – written by Bret Pettichord, Paul Rogers and many other contributors.
  • 4. What WATIR is not...  Watir is not a record/playback tool.  However, there are several recorders “out there”  WatirMaker  Watir WebRecorder  Webmetrics RIA Script Recorder (most recent discussion…they are considering open sourcing their application)  Watir is not a link checker.  However, you can easily write your own link checker and customize it to your specific needs.  Watir is not a test case management tool.  However, you can write one in Ruby if desired.  Doesn’t test Flash or Applets.
  • 5. What is Ruby?  Full featured Object Oriented scripting language  Made “famous” for it’s web application framework Rails. (Ruby on Rails)  Interpreted rather than compiled  Written by Matz (Yukihiro Matsumoto)  Started in 1994  Written in C  Will work on any platform that has a C compiler  Windows  Linux
  • 6. How does Watir works?  Uses the COM interface of Internet Explorer (IE)  Allows an external program to control IE  Similar interfaces exist for Word, Excel, PowerPoint and Outlook.  Full access to the contents of an HTML page  Provides different ways to access objects
  • 7. The Big Question : Why Watir?
  • 8. Why Watir? (contd...)  As a testing tool: It’s as robust & sophisticated as ‘professional’ tools such as Rational, Mercury & Segue.  As a library of a programming language [Ruby ] : It’s powerful.  (You have the power to connect to databases, read data files, export XML, structure your code into reusable libraries, and pretty much anything else you can think of…)  No “Vendor-script”  It’s simple – elegant – INTUITIVE  It has a supportive online community for when you get ‘stuck’.
  • 10. Learning WATIR : Getting Started As you start to get into Ruby/Watir you’ll want some Good information at your fingertips! Introductory Documentation:  Watir homepage: http://watir.com  Watir User Guide: http://en.wikipedia.org/wiki/watir Books:  Everyday Scripting with Ruby: for Teams, Testers, and You: http://pragprog.com/book/bmsft/everyday-scripting-with-ruby  Programming Ruby (Online Book): http://ruby- doc.com/docs/ProgrammingRuby/
  • 11. Learning WATIR : More In-Depth Forums:  Watir General Forum (now on Google Groups): http://groups.google.com/group/watir-general?hl=en  Watir Search (web interface that searches 7 Watir sites): https://www.google.com/cse/home? cx=007267089725385613265:gmydx5gtw6u  Online Ruby Information: http://www.ruby-doc.org/  Watir Book : https://github.com/watir/watirbook
  • 12. Development Environment's(IDE's) for Ruby Use any text editor as an IDE:  ScITE (Free)  Included with your ruby download.  Notepad ++(Free)  Eclipse (using RDT Plugin)  http://rubyeclipse.sourceforge.net/  Ruby In Steel (Free - $199) (Add-on to VS.Net )  http://www.sapphiresteel.com  Komodo IDE ($295) / Komodo Edit (Free)  http://www.activestate.com
  • 13. Using Ruby's Interactive Command Interpreter (IRB)  What is it?  Interactive Ruby.  It evaluates Ruby expressions from the Terminal.  Used To:  Run quick experiments to see if things will work in your tests – irb (main) : 001 : 0> require 'watir'. – irb (main) : 002 : 0> require 'watir-webdriver'. – irb (main) : 003 : 0> browser = Watir::Browser.new'. – irb (main) : 004 : 0> browser.goto 'http://google.com'
  • 14. Let's Get Started.. It’s time to turn on the Watir!
  • 15. Anatomy of Watir Script # Loads the watir gems require 'watir' # Loads all the gems required to drive firefox and chrome require 'watir-webdriver' # To open a new browser(firefox) browser = Watir::Browser.new :firefox # Navigate to the below URL browser.goto 'http://ourgoalplan.com/' # Identify the field to which data is to be inserted and enter the value browser.text_field(:name => 'txtName').set 'subhasish.pattanaik' browser.text_field(:name => 'txtPassword').set 'subh_2727' # To click the button browser.button( :id => 'btnLogin').click # To enter the goals in the Text area browser.text_field( :id => 'ucAddGoal_txtAddGoal').set '[CIRRATA- WP] : TESTING + ISSUES REPORTING[EST - 2HRS]' + "n" + '[COMMETTE] : TESTING + ISSUES REPORTING[EST - 2HRS]' # To click on the Add Goal button browser.button( :id => 'ucAddGoal_btnAddGoal').click
  • 16. Use Watir  Using Watir API is very easy.  Reference the Watir API using the keyword 'require' and start coding. require 'watir' require 'watir-webdriver' browser = Watir::Browser.new :firefox
  • 17. Web Pages are all about Objects  Web pages are developed with objects:  Links, buttons, tables, drop-down boxes, forms, frames, etc.  Watir scripts need to access these objects & manipulate them just as a user would.  Clicking, submitting, typing, selecting, etc…
  • 24. A Closer Look... at the structure browser.button(:value, "Click Me").click [Variable] . [method] (: [element] , “ [unique identifier]” . [method]
  • 25. Test Automation is MORE than Identifying Objects  Identifying objects is currently the most time consuming part of creating your test scripts…  However, after your objects have been identified & manipulated: you want to “Test” them!  You’ll want to create “PASS” or “FAIL” scenarios. …This is the most sophisticated part of your scripts. Will learn more on this in next seminar...
  • 26. Congratulations! You are on your Way …to programming the Ruby-Watir way !!
  • 27. References 1. https://github.com/watir/watirbook 2. http://watir.com/ 3. http://watir.com/examples/ 4. http://www.thoughtworks.com/insights/articles/automated- testing-using-ruby-and-watir 5. http://watirwebdriver.com/ 6. http://www.rubywatir.com/ 7. http://en.wikipedia.org/wiki/Watir