Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Home

lfidnl edited this page · 11 revisions
Clone this wiki locally

Installation

gem install watir-or

Usage

Create a repository

Choose type of repository and create it according structure. Supported types:

Create repository object in your test

require 'watir-or'
require 'watir' # Support all "watirs": firewatir, safariwatir and etc

browser = Watir::IE.start("http://watir.com/") 

repository = ObjectRepository::Repository.new("path_to_your_repository_file.xls", browser)

Getting element form repository

Several ways to get element from repository:

  • by repository id or by description. repository.get("any_rep_id_or_description")
  • only by id. repository.get_by_id("any_rep_id")
  • only by description. repository.get_by_description("any_description")

If element wasn't found, error will be raised

Example of using

browser.goto("http://watir.com")

repository.get("Installation link").click 
#Instead of browser.div(:id => "nav").link(:href => "http://watir.com/installation/").click
if repository.get("Supported platforms").li(:text => "Linux").exists? 
#Instead of browser.div(:id => "content").div(:class => "snap_preview").li(:text => "Linux").exists?
  puts "Linux is avaible"
end

full example: http://github.com/lfidnl/watir-or/tree/master//examples/

Something went wrong with that request. Please try again.