It's most likely exactly what Titus suggested. One other thing you can do, in
addition to providing the HTML he asked for, is to see how many elements there
are that match. Stuff like this:
b.checkboxes(:id => 'sv').length # More than 1? If so, the one you want may be
one of the others
b.checkboxes(:id => 'sv').find_all { |cb| cb.present? }.length # Count of how
many are accessible.
b.checkboxes(:id => 'sv').each { |cb| cb.set if cb.present? } # Set any that
are accessible.
...and variations of that, kind of like how you were doing it below...
From: Literate Aspects <[email protected]>
To: Watir General <[email protected]>
Sent: Tuesday, August 9, 2016 5:31 PM
Subject: [wtr-general] Re: "watir webdriver cannot select checkbox input
element"
WOW, thank you!
What do I need to supply back to you?
Jon
On Tuesday, August 9, 2016 at 5:13:48 PM UTC-7, Titus Fortner wrote:
I just replied to your stackoverflow post. Please provide the applicable html.
If `when_present` times out, then something is hiding the element, and that is
likely at the root of your issue.
Titus
On Tuesday, August 9, 2016 at 7:08:25 PM UTC-5, Literate Aspects wrote:
Please, any suggestions greatly appreciated.
Attempting to identify the element to be able to check the checkbox.
REF: "watir webdriver cannot select checkbox input element"
SELECTOR: #svELEMENT: <input type="checkbox" class="form-checkbox
form-checkbox--inline" data-js-id-lang="27" id="sv">
Please, any suggestions greatly appreciated. I have tried:
FROM: b.span(:text, 'Svenska').clickIRB returns: Unable to locate element
FROM: b.span(:text, 'sv').clickIRB returns: Unable to locate element
FROM: b.execute_script("$('input: checkbox[id=\"sv\"]').attr(' checked',
'checked');")IRB returns: nil
FROM: b.execute_script("document. getElementById('sv').click();" )IRB returns:
nil
FROM: b.checkbox(:id => 'sv').fire_event :onmousedownIRB returns: false
FROM: b.checkbox(:id => 'sv').fire_event :onclickIRB returns: true
FROM: b.checkbox(:id => 'sv').fire_event :clickIRB returns: true
FROM: b.checkbox(:id => 'sv').when_present.setIRB returns: time out (30
seconds)
FROM: b.checkbox(:id => 'sv').fire_event :setIRB returns: true
FROM: b.checkbox(:id => 'sv').fire_event :hoverIRB returns: true
FROM: b.input(:id, "sv").to_subtype.setIRB returns: Element is currently not
visible
FROM: b.select_list(:id => 'sv').option(:text => 'sv').selectIRB returns:
Unable to locate element
FROM: b.input(:id, "sv").setIRB returns: located=false
--
--
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]
---
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
--
--
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]
---
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.