$browser.element(:xpath, "//label[@class='checkbox']/input").isvisible?

On Fri, Nov 8, 2013 at 8:58 AM, Ankita <[email protected]> wrote:

> Not really sure what could be the best way apart from jquery ...
> try to use xpath to see if the checkbox is visible as sometimes its not
> visible on screen and then the set method won't work
>
> use
> $browser.element(:xpath, "//label[@class='checkbox']/input]").isvisible?
>
> and see what you get
>
> On Fri, Nov 8, 2013 at 8:45 AM, Mihir Dhandhusaria <[email protected]>wrote:
>
>> Hey Ankita,
>>
>> I tired but its not selecting checkbox . Do you recommend something else
>> ?
>>
>>
>> On Thu, Nov 7, 2013 at 4:33 PM, ankita bansal <[email protected]>wrote:
>>
>>> Hi Mihir
>>>
>>> you should not be using "click" with $browser.execute_script("$('
>>> input:checkbox[name=\"termsAgree\"]').attr('checked', 'checked')")
>>>
>>> This jquery script automatically checks the checkbox..
>>>
>>>
>>> On Fri, Nov 8, 2013 at 4:43 AM, John Fitisoff <[email protected]>wrote:
>>>
>>>> One other thing that might work is to set the visibility on the
>>>> checkbox via Javascript. I don't have an example of that at my fingertips
>>>> but maybe someone else has one. There's an article on how to use the
>>>> execute_script method here.
>>>>
>>>>
>>>> http://jkotests.wordpress.com/2013/03/19/passing-watir-elements-to-execute_script/
>>>>
>>>> There may be something you need to do to change the visibility of the
>>>> checkbox before acting on it (fire some event or sequence of events).
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   On Thursday, November 7, 2013 7:44 AM, Mihir Dhandhusaria <
>>>> [email protected]> wrote:
>>>>   Hey john thanks for your response. this is what i get as output
>>>>
>>>>      2
>>>>       found it
>>>>       element not visible
>>>>
>>>> but it never selects checkbox
>>>>
>>>>
>>>> On Thu, Nov 7, 2013 at 10:36 AM, John Fitisoff <[email protected]>wrote:
>>>>
>>>> Maybe try this *right* before the line that fails:
>>>>
>>>> sleep 30
>>>> puts $browser.checkboxes.length
>>>> $browser.checkboxes.each do |cb|
>>>>   if cb.html =~ /name="termsAgree"/
>>>>     puts "found it"
>>>>     cb.click
>>>>   end
>>>> end
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   On Thursday, November 7, 2013 7:06 AM, Mihir Dhandhusaria <
>>>> [email protected]> wrote:
>>>>   answers
>>>>
>>>> 1. Does this checkbox become visible on clicking any item?
>>>> NO
>>>>
>>>> 2. Is it a static checkbox or does it appear dynamically based on some
>>>> events that get triggered?
>>>> Its a static check box
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Nov 7, 2013 at 10:02 AM, anukul <[email protected]>wrote:
>>>>
>>>> Few questions for you:
>>>>
>>>> 1. Does this checkbox become visible on clicking any item?
>>>> 2. Is it a static checkbox or does it appear dynamically based on some
>>>> events that get triggered?
>>>>
>>>>
>>>> Sent from BlackBerry® on Airtel
>>>> ------------------------------
>>>> *From: * Mihir Dhandhusaria <[email protected]>
>>>> *Sender: * [email protected]
>>>> *Date: *Thu, 7 Nov 2013 09:56:38 -0500
>>>> *To: *<[email protected]>
>>>>  *ReplyTo: * [email protected]
>>>> *Subject: *Re: [wtr-general] Accessing checkbox using watir webdriver
>>>>
>>>> Tried didnt work. gives me following error
>>>>
>>>> timed out after 30 seconds, waiting for {:name=>"termsAgree",
>>>> :tag_name=>"input", :type=>"checkbox"} to become present
>>>> (Watir::Wait::TimeoutError)
>>>>
>>>>
>>>> On Thu, Nov 7, 2013 at 9:53 AM, anukul <[email protected]>wrote:
>>>>
>>>> What about $browser.label(:class, "termsAgree").checkbox(:name,
>>>> "termsAgree").when_present.set
>>>>
>>>> Can you try this?
>>>>
>>>> Sent from BlackBerry® on Airtel
>>>> ------------------------------
>>>> *From: * Mihir Dhandhusaria <[email protected]>
>>>> *Sender: * [email protected]
>>>> *Date: *Thu, 7 Nov 2013 09:47:42 -0500
>>>> *To: *<[email protected]>
>>>> *ReplyTo: * [email protected]
>>>> *Subject: *Re: [wtr-general] Accessing checkbox using watir webdriver
>>>>
>>>> courser i tired that but somehow watir can't identify that checkbox i
>>>> assuming because of Jquery
>>>>
>>>>
>>>> On Thu, Nov 7, 2013 at 9:46 AM, anukul <[email protected]>wrote:
>>>>
>>>> Looking at your html, can you try the simple option (assuming you are
>>>> trying to set the checkbox):
>>>>
>>>> $browser.checkbox(:name, "termsAgree").set
>>>>
>>>> Let me know if this works or not.
>>>>
>>>> Thanks,
>>>> Anukul
>>>> Sent from BlackBerry® on Airtel
>>>> ------------------------------
>>>> *From: * Mihir Dhandhusaria <[email protected]>
>>>> *Sender: * [email protected]
>>>> *Date: *Thu, 7 Nov 2013 06:37:30 -0800 (PST)
>>>> *To: *<[email protected]>
>>>> *ReplyTo: * [email protected]
>>>> *Cc: *John Fitisoff<[email protected]>
>>>> *Subject: *Re: [wtr-general] Accessing checkbox using watir webdriver
>>>>
>>>> hey i tired this but didn't work. says element not visible
>>>>
>>>> On Wednesday, November 6, 2013 6:08:36 PM UTC-5, johnssn wrote:
>>>>
>>>> Just for fun:
>>>>
>>>> $browser.span(:text=>/I agree to the/).parent.checkboxes[0].set
>>>>
>>>>
>>>>
>>>>   On Wednesday, November 6, 2013 2:15 PM, Ankita <[email protected]>
>>>> wrote:
>>>>  I have experienced too that some times we need to trigger the
>>>> checkbox event with jquery instead of simple watir methods..
>>>>
>>>> Try this, might work..
>>>>
>>>> *$browser.execute_script("$('input:checkbox[name=\"termsAgree\"]').attr('checked',
>>>> 'checked');")*
>>>>
>>>>
>>>> On Thu, Nov 7, 2013 at 9:04 AM, Mihir Dhandhusaria 
>>>> <[email protected]>wrote:
>>>>
>>>> This is my html
>>>>
>>>> <label for="termsAgree" class="checkbox">
>>>>     <span class="sprite"></span>
>>>>     <input type="checkbox" name="termsAgree" data-original-title=""
>>>> title="">
>>>>     <span class="message">I agree to the <a href="/termsandconditions"
>>>> target="_blank" class="inline" title="Terms and Conditions">Terms and
>>>> Conditions</a></span>
>>>> </label>
>>>>
>>>> I tired following things and none of them seems to be working.
>>>>
>>>> Option 1:
>>>>   $browser.label(:class => 'checkbox').parent.checkbox(:name =>
>>>> 'termsAgree').set
>>>>
>>>> Option 2:
>>>>  $browser.checkbox(:name => 'termsAgree').focus
>>>>
>>>>
>>>> Any help is appreciated.
>>>>
>>>> Thanks
>>>>
>>>>
>>>>
>>>>  --
>>>> --
>>>> 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/groups/opt_out.
>>>>
>>>>
>>>> --
>>>> --
>>>> 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/groups/opt_out.
>>>>
>>>>
>>>>    --
>>>> --
>>>> 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/groups/opt_out.
>>>>  --
>>>> --
>>>> 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/groups/opt_out.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Mihir Dhandhusaria
>>>> 516-776-6534
>>>>
>>>>
>>>>  --
>>>> --
>>>> 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/groups/opt_out.
>>>>  --
>>>> --
>>>> 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/groups/opt_out.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Mihir Dhandhusaria
>>>> 516-776-6534
>>>>
>>>>
>>>>  --
>>>> --
>>>> 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/groups/opt_out.
>>>>  --
>>>> --
>>>> 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/groups/opt_out.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Mihir Dhandhusaria
>>>>
>>>>
>>>>  --
>>>> --
>>>> 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/groups/opt_out.
>>>>
>>>>
>>>>    --
>>>> --
>>>> 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/groups/opt_out.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Mihir Dhandhusaria
>>>>
>>>>
>>>>  --
>>>> --
>>>> 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/groups/opt_out.
>>>>
>>>>
>>>>    --
>>>> --
>>>> 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/groups/opt_out.
>>>>
>>>
>>>  --
>>> --
>>> 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/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Mihir Dhandhusaria
>>
>>
>>  --
>> --
>> 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/groups/opt_out.
>>
>
>

-- 
-- 
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/groups/opt_out.

Reply via email to