Instead of set on the radio button try .click 


On Thursday, April 7, 2016 at 6:53:38 PM UTC-5, Ricardo RodriguezsSalinas 
wrote:
>
>
>
> El miércoles, 22 de julio de 2015, 6:24:52 (UTC-5), Mahesh Mesta escribió:
>>
>> Hi,
>>
>> I tried using browser.span(:text, 'Submit').click, 
>> It worked.
>>
>> Thank you all !!
>>
>> On Wed, Jul 22, 2015 at 10:28 AM, Chuck van der Linden <[email protected]> 
>> wrote:
>>
>>> On Tuesday, July 21, 2015 at 5:24:04 AM UTC-7, Mahesh Mesta wrote:
>>>>
>>>> I'm using watir to perform automated testing for an application and 
>>>> trying to click on a submit button once I select options for select list 
>>>> and fill up the form.However on clicking the button, it throws element not 
>>>> found error 
>>>>
>>>>
>>>> The html snippet for button tag
>>>>
>>>> <button type="submit" class="md-primary md-raised md-button md-default-
>>>> theme" ng-transclude=""><span class="ng-binding 
>>>> ng-scope">Submit</span><div style="" class="md-ripple-container"></div>   
>>>> </button>
>>>>
>>>> The ruby script
>>>>
>>>> require "watir"require "watir-webdriver"
>>>> browser =  Watir::Browser.new :firefox
>>>> browser.goto 'https://54.69.254.137/webui#/landing'
>>>> browser.driver.manage.window.maximize
>>>> browser.button(:class =>'sign-in md-button md-default-theme').click
>>>> browser.text_field(:id =>'input_001').set('[email protected]')
>>>> browser.text_field(:id =>'input_002').set('password')
>>>> browser.button(:class =>'md-primary md-raised md-button md-default-  
>>>> theme').click
>>>> browser.input(:id =>'input_002').when_present.click
>>>> browser.element(aria_label:'What do you want to do?').when_present.click
>>>> browser.element(:id =>'select_option_00G').when_present.click
>>>> browser.element(aria_label:'About what?').when_present.click
>>>> browser.element(:id =>'select_option_00P').when_present.click
>>>> browser.textarea(:id =>'input_00N').when_present.set('Discuss about 
>>>> javascript and later test the application??')
>>>> browser.button(:class =>'md-primary md-raised md-button md-default-   
>>>> theme').click
>>>>
>>>> It throws the following error
>>>>
>>>> Selenium::WebDriver::Error::ElementNotVisibleError: Element is not 
>>>> currently visible and so may not be interacted with
>>>>
>>>>
>>>> I tried using 
>>>>
>>>> browser.button(:class =>'md-primary md-raised md-button md-default-    
>>>> theme').when_present.click
>>>>
>>>> ,but it will throw time out error.Not able to rectify the error .Plz 
>>>> help !!
>>>>
>>>
>>> So the error you are seeing means that webdriver itself is able to find 
>>> an element using the criteria you specified, but it believes the element is 
>>> not visible to the user (off screen, hidden, or covered by another 
>>> element).  Webdriver tries very hard to not allow you to do something a 
>>> real user could not do, so while it was able to locate the element in the 
>>> DOM, if it does not believe that a user could 'see' the button it refuses 
>>> to click on it and throws the error you saw.
>>>
>>> There are a few possibilities as to what could cause this in a case 
>>> where you can 'see' the button.  The most likely is that there is more than 
>>> one button in the DOM with the class combination you specified, which is 
>>> often the case in fancy sites with multiple 'pop-up' UI elements, Tabs, etc 
>>> where DOM elements are appearing and disappearing by tweeks to their css 
>>> settings.. 
>>>
>>> To check for that, you can get a count of the number of elements that 
>>> match your specification
>>>
>>> count =  browser.buttons(:class =>'md-primary md-raised md-button 
>>> md-default-theme').size 
>>>
>>> puts "there are #{count} buttons of the type we are looking for"
>>>
>>>
>>> if the count is larger than 1, then likely watir is finding the first 
>>> button that matches (which it will in this case) but that button is hidden. 
>>>  You will likely want to find a container (e.g. if the UI has tabs, the div 
>>> that contains the contents of the active tab) and specify that watir should 
>>> look inside that element to find the button you want.  which might look 
>>> something like
>>>
>>>
>>> browser.div(:name => 'Tab3').button(:class =>'md-primary md-raised 
>>> md-button md-default-theme').click
>>>
>>> -- 
>>> -- 
>>> 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.
>>>
>>  
>>
> Hi Chuck
>
> Hi Chuck
>
> This work find for buttons, but when i tried to apply to radio buttons, it 
> still not be visible. I´ve tried to change its style as "visibility: 
> visible"  but it didnt worked , a radio button is still not visible. Exists 
> but watir can´t work with it
> I guess that your comments about how watir works, are very good, but i 
> belive exist an extra scenario where as user i can see some controls, and 
> Watir just can´t see that  exist
> Sample:
> i can detect if an element is visible as:
> browser.radio(:id  => "anyid") or 
> browser.div(:id => "identifier").radio(:name => "anyname")
>
> But when i try to apply the ".set"  as
> browser.radio(:id  => "anyid").set or 
> browser.div(:id => "identifier").radio(:name => "anyname").set 
>
> appears this message ":Element is not currently visible and so may not be 
> interacted with"
>
> Can you have any other idea about this issue?
>

-- 
-- 
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.

Reply via email to