Can I write watir code to click this button element?
The onclick event has to be triggered.
<button onclick="wizardAction('start', 'Starte Upgrade')">
<table align="center" cellspacing="0">
<tbody><tr>
<td><img src="/static/images/stock/gtk-ok.png" align="left" height="16" width="16"></td>
<td nowrap="nowrap">Starte Upgrade</td>
</tr>
</tbody></table>
</button>
Edit:
I tried it this way:
ie.button(:onclick, /start/).click
But it seems onclick is not supported:
> ruby upgrade-module.rb
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:143:in `match?':
onclick is an unknown way of finding an <INPUT> element ((?-mix:start)) (Watir:
:Exception::MissingWayOfFindingObjectException)
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:126
:in `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:124
:in `each'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:124
:in `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:122
:in `catch'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:122
:in `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:119
:in `each'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/locator.rb:119
:in `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/container.rb:8
04:in `locate_input_element'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/input_elements
.rb:5:in `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:53:
in `assert_exists'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:288
:in `enabled?'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:60:
in `assert_enabled'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:233
:in `click!'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:219
:in `click'
from upgrade-module.rb:19