ChromeWatir

Watir

ChromeWatir is part of Watir project.

Contributors

Sai Venkatakrishnan is lead developer of ChromeWatir. Other contributors are listed at ChromeWatir section at Contributors page.

ChromeWatir

ChromeWatir is an implementation of Watir API for Google Chrome browser. The scripting is simple and is similar to Watir.

ChromeWatir has an API similar to Watir and used to drive Google Chrome browser. As of now it works in Windows platform. The support for other platforms will be worked on once Chrome browser gets ported to other platforms like Linux and OSX.

ChromeWatir works well but it is in alpha (May be pre alpha) stage and not production ready yet. We are in the process of making it better by stabilizing it as well adding more functionality. Your help is also needed in making this happen. If you need more info, please see the wiki page about contributions.

The release is available as gem as well as source. Your feedback and contributions are valuable.

If you want to contribute or if you find bugs please contact me.

Introduction

ChromeWatir is the Watir API implementation for Google Chrome browser. The API follows a similar convention to Watir but there are a few differences.

ChromeWatir uses Google Chrome's remote shell port to automate Google Chrome. A TCP connection is established which will connect Chrome's V8 JavaScript engine directly with ChromeWatir. The API uses this connection to send JavaScript and manipulate DOM to automate web applications on Chrome.

Installation

The best way to install ChromeWatir is using Ruby gems. Download the gem from the downloads page. In the command line, navigate to the gem downloaded folder and type

gem install chrome_watir

This will install ChromeWatir in your machine.

If you are getting BinaryNotFoundException, please check if you have chrome in your environment path. If not please add the chrome.exe path to environment variable

Example Script for Google Search

require "chrome_watir"
browser = ChromeWatir::Browser.new
browser.goto 'http://www.google.com'
browser.link(:text, "Advanced Search").click
browser.text_field(:id, "as_oq0").set "watir"
browser.text_field(:id, "as_oq1").set "ruby"
browser.text_field(:id, "as_oq2").set "testing"
browser.radio(:id, "ss").set
browser.button(:value, "Advanced Search").click

Any script which runs on Watir must be able to run on ChromeWatir by changing the driver. Please refer the test files in the installation folder for more information.

Compatibility with Watir

We have tried to make ChromeWatir as compatible with Watir as possible to our knowledge.

Some know problems are

  • Not all the elements supported by Watir are not yet supported by ChromeWatir. We are working on it. The supported elements and their locators can be found in the ChromeWatir Methods Supported by HTML Element page.
  • There are some synchronization problems and instabilities with js shell. We think the automation framework of Chrome will solve this issue.
  • Multiple attribute support for locators is not also in.  We are working on this.

If you find some compatibility issue, please report it at Watir General Google group or Jira, our ticket tracker (make sure to select ChromeWatir component in Jira).

Internal Working

ChromeWatir uses the V8 JS debug shell of Google Chrome. A TCP socket connection is established in the local machine at port 12345 after launching the browser. This connection is then used to inject the javascript into the V8 debugger. This JavaScript will manipulate the DOM to automate the web pages.

There is a plan to move the automation framework provided by Google Chrome internally. This will make ChromeWatir more stable and consistent. But the work on this has not yet started as we are still looking at how we can use this framework written in C++ in Ruby.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.