1
votes

OK i have a weird one I have a check-box that is visible on the page and is click-able. But when i view source it says:

 <input disabled="disabled" type="checkbox" class="billingCheck"  />

my code to is follows:

 browser.checkbox(:class => 'billingCheck').set

I get the following error:

C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-2.0.4/lib/watir/element.rb:84:in `asse rt_enabled': object {:class=>"billingCheck"} and is disabled (Watir::Exception: :ObjectDisabledException)

I tried to use the following but it passed right over the code.

if
browser.checkbox(:class => 'billingCheck').visible?
browser.checkbox(:class => 'billingCheck').set
end

Any ideas? Thanks in advance.

1
Is there more than one checkbox with the same class at the page? What does this return? browser.checkboxes(:class => 'billingCheck').sizeŽeljko Filipin
yes there could be more checkboxes, they get dynamically created when creating a new account. Each checkbox has the same codemike
Then your code accesses a checkbox that is disabled.Željko Filipin
Disabled is not the same as not visible. Of course Disabled.disabled seems to be a double negative, so maybe that means enabled? ;-) You should get the developers to make a better web page.Dave McNulla

1 Answers

0
votes

Try this:

browser.checkboxes(:class => 'billingCheck').each {|checkbox| checkbox.set if checkbox.visible?}