Questions tagged [watir-webdriver]

Watir (Web Application Testing in Ruby) implementation built on WebDriver's Ruby bindings. Used for web browser automation, this tool allows you to code in Ruby using the friendly Watir API but get the cross browser support of Webdriver to automate Chrome, Firefox, IE, Opera or a 'headless' browser. Distributed as a Ruby gem named 'watir-webdriver'

For those who don’t know what Watir-WebDriver is, it’s basically a nice Watir (ruby) implementation on WebDriver, so it gives you five browsers (four real, one headless) using one neat API, out of the box.

The Watir API uses an object model that parallels the HTML element model and the browser DOM. This allows you to write very natural OOP code where you can have a button in the UI click itself. (as opposed to Selenium where the 'browser' object does everything, and takes the elements as parameters for methods like click.

See: watirwebdriver.com

1623 questions
8
votes
1 answer

How to get the number of elements having same attribute in HTML in Watir?

I have a HTML document which contains elements having the same class name. I could just do an iteration over all the elements in a page and store with elements with a class name in a list. Is there a better way in Watir to get a count of all the…
chaitanya
  • 1,591
  • 2
  • 24
  • 39
8
votes
1 answer

How do I make a word optional in a Cucumber step definition?

I have a step definition, below, that does what I want it to do i.e. it checks the url of the page against the 'page' element of 'PAGES' hash. Then(/^I should( still)? be at the "(.*)" page$/) do |still, page| BROWSER.url.should ==…
Karl Cummins
  • 93
  • 1
  • 1
  • 8
8
votes
3 answers

Chrome/Firefox do not retain cookies when invoked via (Watir-)Webdriver?

I am working on a project for a client using Ruby & Watir. He requires that the session is restored when the application is reloaded (so to save his login states). This is the normal behavior of Chrome (it seems), and Firefox has the option to do…
8
votes
3 answers

Check if "Please enter an email address" message appears

Given a simple page:
If I enter anything in text field that is not e-mail and click the button, Please enter an email address message appears. Is there a way to to check if the message…
Željko Filipin
  • 56,372
  • 28
  • 94
  • 125
8
votes
2 answers

Timeout Errors when running tests Cucumber/Watir

I was hoping someone could help me with a problem I am encountering when running my cucumber tests. I receive the following error: Timeout::Error (Timeout::Error) C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill' …
user1523236
  • 1,403
  • 3
  • 20
  • 43
7
votes
2 answers

Handling a javascript popup occurring on a keyup event

I have a text-field on a HTML page which checks whether you have entered a value between 1 to 365. If the user enters an invalid value like a non-numeric character or a value which does not fall inside the range, it shows a popup. I saw on the watir…
chaitanya
  • 1,591
  • 2
  • 24
  • 39
7
votes
3 answers

Ruby - require 'watir-webdriver' - generates a LoadError no such file... Why?

I am new to Ruby and would really appreciate some help understanding what is going on here. Summary: Gem install watir-webdriver Installs fine start irb require "watir-webdriver" ... LoadError: no such file to load --watir-webdriver Surely this…
Dirk
  • 3,073
  • 4
  • 31
  • 36
7
votes
1 answer

What are the limitations of mechanize? and what is the difference(s) between mechanize and watir

I am using mechanize to scrap some web pages. I need to know what are mechanize limitations? What mechanize can not do? Can it execute javascripts embedded in the web page? Can I use it to call javascript functions? I don't think it can. I think…
Mahmoud Khaled
  • 6,226
  • 6
  • 37
  • 42
7
votes
2 answers

How to determine browser type (IE, FF, Chrome, etc.)

I'm in the process of switching my Watir / FireWatir scripts over to use watir-webdriver and need a means in watir-webdriver to determine which type of browser the test is currently being executed against, (IE, FF, Chrome). With Watir / FireWatir…
Joe
  • 71
  • 2
7
votes
2 answers

Testing if a new window opens with Watir-Webdriver

I'm using Watir-webdriver and I was wondering if there was a good way to check if a new window opens. I've googled around a bit and couldn't find anything though it feels like there should be an easy answer. I have a printer friendly link and I want…
Mike
  • 149
  • 2
  • 12
7
votes
3 answers

How do I get watir-webdriver to start Firefox 4 with Firebug?

Any ideas? I've tried setting webdriver.firefox.useExisting=true as described in the link below hoping to reuse an existing window with firebug enabled, but no such luck. http://code.google.com/p/selenium/wiki/FirefoxDriver
Richard Finegan
  • 1,895
  • 2
  • 12
  • 8
7
votes
1 answer

watir-webdriver checking table size rows and columns count

I am starting the process of converting my WATIR scripts to use WATIR webdriver. There a couple of table methods I was using in my WATIR scripts to check the size (rows and columns) of a HTML table. myTable.row_count myTable.column_count These…
Alastair Montgomery
  • 1,756
  • 5
  • 21
  • 44
7
votes
3 answers

How to handle tinyMCE when automating with watir-webdriver?

I'm evaluating Watir-webdriver, to decide if i can switch to using it for my browser tests (from Watir mostly) and one of the key things would be the ability to interact with TinyMCE WYSIWYG editors, as a number of the applications I work with use…
sean_robbins
  • 684
  • 6
  • 17
7
votes
4 answers

How to deal with JavaScript Error: "e is null" when try to click on browser pop-up in Firefox

When using the alert methods of selenium-webdriver, I encountered the JavaScript Error: "e is null" Code: browser = Watir::Browser.new :firefox browser.alert.ok; sleep 5 Error: Selenium::WebDriver::Error::UnknownError: [JavaScript Error: "e is…
7
votes
8 answers

How to execute Multiple cucumber feature files using tags

I am trying to run multiple feature file using tags, i have tried the command cucumber --tag @some_name --tag @some_name1. But it throws an error which reads as follows, "WARNING: cannot load such file -- 2.0/gherkin_lexer_en Couldn't load…
user3486694
  • 73
  • 1
  • 2
  • 7