lfidnl edited this page Oct 3, 2010 · 11 revisions
Clone this wiki locally


gem install watir-or


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


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"

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