Author Archives: Justin Ko

Set styled radio buttons and checkboxes that have hidden or overlapped the input field

Problem There seems to be an upward trend in applications using label elements to style radio buttons and checkboxes. This can cause issues when Watir tries to set the field. For example: Setting a jQuery Mobile checkbox, results in the … Continue reading

Posted in Watir, Watir-Webdriver | Tagged , | Leave a comment

Determine the feature directory in Cucumber hooks

Problem Today’s Stack Overflow question, “Is it possible to know from which folder cucumber scenario is running?” by Den Silver, was looking to apply hooks based on a feature file’s folder. While I can see the merit of this approach, … Continue reading

Posted in Cucumber | Tagged , | Leave a comment

Finding visible/hidden elements with the new :visible locator

Watir 6.0 introduces a new locator – :visible. This allows you to specify whether or not the element can be seen by the user. Usage Consider the following page where the first div is visible and first span element is … Continue reading

Posted in Watir | Tagged , | Leave a comment

ParallelTests::RSpec::RuntimeLogger ignores first process

Problem Inspired by a recent meeting with the team at Loblaws Digital, I have been looking at tools to improve the execution of my regression suite. To address an ever growing execution time, I turned to the ParallelTests gem. This … Continue reading

Posted in RSpec | Tagged | 1 Comment

Finding the next empty text field

Problem As I continued to investigate making Watir-Classic tests compatible with Watir-Webdriver, I noticed one test that failed to input the next empty row of a text field grid. The grid could start empty or it could start with rows … Continue reading

Posted in Watir, Watir Migration, Watir-Webdriver | Tagged , , | Leave a comment

Replace Table#row_count and Table#column_count with an ElementCollection#count

Given a table: You might want to check the number of rows and/or columns. Obsolete Method In Watir-Classic you may have retrieved these values using the row_count and column_count methods. However, these methods will give an error in Watir-Webdriver: Preferred … Continue reading

Posted in Watir, Watir Migration, Watir-Classic | Leave a comment

Watir 6.0 is the end of the Watir metagem

The Watir gem started out as driver for IE through the OLE protocol. In 2012, version 4.0.0 changed Watir into a metagem that, based on the desired browser, used either Watir-Classic (the original implementation) or Watir-Webdriver (the Selenium backed implementation … Continue reading

Posted in Watir, Watir-Classic, Watir-Webdriver | Leave a comment