Reputation: 3411
<div class="icheckbox_minimal" style="position: relative;">
<input class="checkbox" type="checkbox" value="1" name="order[terms]"
id="order_terms" style="position: absolute; top: -20%; left: -20%;
display: block; width: 140%; height: 140%; margin: 0px; padding: 0px;
background: rgb(255, 255, 255); border: 0px; opacity: 0;">
<ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%;
display: block; width: 140%; height: 140%; margin: 0px; padding: 0px;
background: rgb(255, 255, 255); border: 0px; opacity: 0;">
</ins>
</div>
How can I set the checkbox for this element?
I tried the following
browser.checkbox(:class => "iCheck-helper").when_present.set
browser.div(:class => "icheckbox_minimal").fire_event :click
Upvotes: 0
Views: 464
Reputation: 5347
you can click on ins tag to set the check box value as given below.
if !browser.checkbox(id: 'order_terms').set? then
puts "not set"
browser.element(class: 'iCheck-helper').click
end
puts browser.checkbox(id: 'order_terms').set?
Upvotes: 1
Reputation: 6064
Try this
browser.checkbox(id: "order_terms").set
When you locate an element, that element has to be checkbox when you use the method checkbox but you are passing the locator of div to checkbox method.
Upvotes: 0