" irb(main):004:0> b.button(:text => /Google zoeken/).id => "gbqfba" irb(main):005:0> All the" /> " irb(main):004:0> b.button(:text => /Google zoeken/).id => "gbqfba" irb(main):005:0> All the" />
 

blog

Let's talk about testing

Easy debugging of your test automation watir-webdriver scripts

This entry is part 5 of 10 in the series Test Automation

Hi All,

When you are using watir-webdriver for web testautomation, you might encounter problems that are not be easy to debug. For example interaction with page elements such as links or buttons that are hidden. Or locating elements in other iframes. One easy way to see what is going on is by interacting with your web browser through the command line!

To make this happen, make sure you have;

  1. a recent version of ruby installed (1.9.3 or later)
  2. a recent version of firefox installed
  3. the ruby gem ‘watir-webdriver’ installed;
gem install 'watir-webdriver'

Now, start the Interactive Ruby Shell…
In this irb, after loading ‘watir-webdriver’, you can start firefox with one command and interact with it right away!

sC-MBP:~ sCblogger$ irb
irb(main):001:0> require 'watir-webdriver'
=> true
irb(main):002:0> b = Watir::Browser.new
=> #
irb(main):003:0> b.goto "www.google.com"
=> "http://www.google.nl/"
irb(main):004:0> b.button(:text => /Google zoeken/).id
=> "gbqfba"
irb(main):005:0>

Screen Shot 2013-04-12 at 10.59.17 AM

All the functions that are supported by watir-webdriver can be found on the Rubydoc.info website

NOTE: with ruby 1.8.7 or earlier, you’d have to require ‘rubygems’ first before require ‘watir-webdriver’


Comments are closed.

Reputation. Meet spriteCloud

Find out today why startups, SMBs, enterprises, brands, digital agencies, e-commerce, and mobile clients turn to spriteCloud to help improve their customer experiences. And their reputation. With complete range of QA services, we provide a full service that includes test planning, functional testing, test automation, performance testing, consultancy, mobile testing, and security testing. We even have a test lab — open to all our clients to use — with a full range of devices and platforms.

Discover how our process can boost your reputation.