Watir-Page-Helper 0.3.0: now with added frames

I’ve just release version 0.3.0 of my watir-page-helper gem, with support for frames.

To use a frame, you define it as you would any other element:

class PageIFrame < BasePageClass
  direct_url TEST_URL
  frame :iframe, :id => "myiframe"
  link(:ilink) { |page|  page.iframe.link(:text => 'Link in an iFrame') }

and then you can use the frame, or any elements within that frame:

it "should support elements within a iframe" do
  page = PageIFrame.new @browser, true
  page.iframe.exist?.should be_true
  page.ilink_link.exist?.should be_true

I hope you find this update useful.

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.

4 thoughts on “Watir-Page-Helper 0.3.0: now with added frames”

  1. I’ve been trying to do some testing which involves sending an e-mail through the Gmail web interface. At the moment I have some code which looks like this;

    require ‘./base-page’

    class GmailPage ‘canvas_frame’

    frame :canvas, :id => ‘canvas_frame’
    div(:compose) { |page| page.canvas.link(:text => ‘Compose mail’) }
    div(:send) { |page| page.canvas.div(:text => ‘Send’) }
    text_field(:to) { |page| page.canvas.text_field(:name => ‘to’) }
    text_field(:subject) { |page| page.canvas.text_field(:name => ‘subject’) }

    def compose_mail to, subject, content
    self.to = to
    self.subject = subject

    but when I run the compose_mail method I get;

    /Users/cs1ajb/.rvm/gems/ruby-1.9.2-p290/gems/watir-page-helper-0.3.0/lib/watir-page-helper/generated.rb:139:in `block in div’: wrong number of arguments (1 for 0) (ArgumentError)
    from /Users/cs1ajb/.rvm/gems/ruby-1.9.2-p290/gems/watir-page-helper-0.3.0/lib/watir-page-helper/generated.rb:344:in `block in text_field’
    from /Users/cs1ajb/src/web-tests/gmail.rb:17:in `compose_mail’
    from ./runme.rb:10:in `block in ‘
    from /Users/cs1ajb/.rvm/gems/ruby-1.9.2-p290/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/common/target_locator.rb:37:in `window’
    from /Users/cs1ajb/.rvm/gems/ruby-1.9.2-p290/gems/watir-webdriver-0.3.3/lib/watir-webdriver/window_switching.rb:99:in `use’
    from ./runme.rb:8:in `’

    Any ideas? – I realise the Gmail interface is pretty complex, and I could make this much easier on myself by using the simple HTML interface, but the challenge is part of the fun! I’m quite the beginner with Watir and Ruby, so I imagine it’s something really simple!


  2. Are you planning on adding features for dealing with page modules (also known as partials) that get inserted into multiple pages, e.g. headers, footers, side bars etc. It would be nice if they could be defined as modules and included in a Page class.


Comments are closed.