Željko Filipin's Blog on Software and Testing

Test like you do not need the money.

Archive for July, 2007

How to Get Text from Status Bar

without comments

p6220071.JPG

There was an interesting question recently at Watir General forum. How to get text from Internet Explorer status bar using Watir? I did not know that it was possible. Not only it is possible, but it is so easy.

ie.status
=> “Done”

I just had to put it at How To page of Watir Wiki.

Written by Željko Filipin

July 12th, 2007 at 4:38 pm

Posted in Watir

Extend Watir

with 2 comments

p6210022.JPG

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'
  end
  module Container
    def h4(how, what)
      return H4.new(self, how, what)
    end
  end
end

Now this works.

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

Written by Željko Filipin

July 4th, 2007 at 11:42 am

Posted in Watir

Tagged with

Find Element by XPath

without comments

p6090033.jpg

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 Angrez Singh was kind enough to help.

This will click h4 headline.

browser.element_by_xpath("//h4[@id='addproject']").click

Written by Željko Filipin

July 3rd, 2007 at 4:18 pm

Posted in Watir

Tagged with