Monthly Archives: November 2012

Get attribute values of the html element

Problem One of the WCAG2.0 requirements is that the default human language of each web page can be programmatically determined. (Success Criterion 3.1.1). One of the methods for meeting this criteria is to include the “lang” and/or “xml:lang” attribute in … Continue reading

Posted in Watir, Watir-Classic, Watir-Webdriver | Tagged , | 2 Comments

Modify each word except the first

Problem I had a string representing a CSS property that needed to be converted to a DOM style object property. For example, the string: “font-weight” had to be modified to: “fontWeight” Basically, two changes needed to be made to the … Continue reading

Posted in Ruby | Tagged , | Leave a comment

Dry run to list all specs in RSpec 2

Problem To my understanding, RSpec 1 could generate a list of the existing tests using the “–dry-run” option. However, it was removed in RSpec 2 due to the new self-describing matchers/one-liners (see RSpec-Core Issue 354 and Issue 469). The two … Continue reading

Posted in Automation | Tagged , | 2 Comments

Opening local HTML files with Watir-Classic

Problem In Watir-Webdriver, a local HTML file can be opened using: When using Watir-Classic, this code navigates to “http://c/Users/testuser/Desktop/test.htm” with the message “Internet Explorer cannot display the webpage”. While attaching to a browser with a local HTML file works, how … Continue reading

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

Checking for an element – exists?, visible?, present?

Observation Back when I started Watir, there was only one method to check for an element on the page – Element#exists?. Now, several versions later, there are three – Element#exists?, Element#visible? and Element#present?. The three methods are not aliases of … Continue reading

Posted in Watir, Watir-Classic, Watir-Webdriver | Tagged , , , , , | 6 Comments