Hi,
I asked this some days ago in a webdriver forum but haven't gotten any
response.
It's sort of a followup to my earlier question on how to set the value
of an input element because I decided just to change the code to make
it explicitly find the element as a checkbox.
I have the following code:
When /^I (un)?check "([^\"]*)"$/ do |negate, checkbox_label|
flag = ("un" != negate)
checkbox = $browser.checkbox(:id, checkbox_label)
puts checkbox.exists?
puts "checking checkbox"
puts checkbox.set?
if(flag)
puts "now what"
checkbox.set
puts checkbox.set?
else
puts "dont set id"
checkbox.clear
end
end
The html that is being checked is
<input type="checkbox" title="Tilføj til din aftale"
autocomplete="off" id="check_PP-INTERNET-HOSTING-EN_CL1_ALT1"
onclick="toggle_alt(this, 'PP-INTERNET-HOSTING-EN_CL1_ALT1',
'panel_PP-
INTERNET-HOSTING-EN_CL1_ALT1');">
And the output reads
true
checking checkbox
false
now what
false
And I check "check_PP-INTERNET-HOSTING-EN_CL7_ALT1"
so true checkbox exists,
no error when I try to checkbox.set,
but false for checkbox.set?
Any ideas what can be causing this, and any ways I can get around it.
Thanks,
Bryan Rasmussen
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]