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

Željko,
Is it possible to overload the method so if we do not specify the parameter ‘how’, the method will try to use :id and :name.
So we could use the method:
ie.h4(“addproject”).click
This is how InCisif.net works.
Thanks.
Frederic Torres
5 Jul 07 at 2:18 am
Frederic,
It would be the best to post your question at Watir forum. This is the link to this thread. http://forums.openqa.org/thread.jspa?threadID=8972&tstart=0
Željko Filipin
5 Jul 07 at 10:39 am