Željko Filipin's blog.
Home Blog Tags License

View on GitHub
4 July 2007

Extend Watir

by Željko Filipin

I had to click a h4 headline.

<h4 id="addproject">Create a new project</h4>

This did not work.

browser.h4(:id, "addproject").click

I posted a question to wtr-general mailing list and Bret Pettichord suggested to extend Watir with this, so it would support h4 headlines.

module Watir
  class H4 < NonControlElement
    TAG = 'H4'
  module Container
    def h4(how, what)
      return, how, what)

Now this works.

browser.h4(:id, "addproject").click
tags: code - ruby