Archive for July, 2007
How to Get Text from Status Bar
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.
Extend Watir
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
Find Element by XPath
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

