Okay, this actually resolves the problem, Yes as you say, it's inside the 
frame and when I use as shown below

iframe1 = browser.iframe(id: 'iframe1')
iframe1.element(id: 'element_inside_frame').click

it works, But another problem arises in the case of alert, I don't know how 
to handle alert now. 

If I write 

iframe1.alert.ok 

It simply throws the error by saying 'alert' function is not found for 
iframe1. Can you tell me how to handle the alert when alert appears inside 
the frame? 

On Friday, July 28, 2017 at 11:58:10 PM UTC+5:30, Titus Fortner wrote:
>
> Working with iframes is approached differently in selenium & Watir.
> In Selenium you are responsible for explicitly switching into and out of 
> the context you want:
>
> driver.switch_to.frame('iframe1')
> driver.find_element(id: 'element_inside_frame').click
> driver.switch_to.default_content
> driver.find_element(id: 'element_outside_frame').click
>
> Watir handles this for you:
>
> browser.iframe(id: 'iframe1').element(id: 'element_inside_frame').click
> browser.element(id: 'element_outside_frame').click
>
> The tradeoff for this behavior is that you have to include the iframe 
> definition as part of every element signature inside the iframe.
> For convenience, feel free to:
>
> iframe1 = browser.iframe(id: 'iframe1')
> iframe1.element(id: 'element_inside_frame').click
> iframe1.element(id: 'also_inside_frame').click
>
>
> You could have elements with the same id in multiple different 
> frames/browsing contexts. Watir requires you to explicitly specify which 
> one you want. 
>
>
> On Fri, Jul 28, 2017 at 12:42 PM, Raja gopalan <rajagopa...@gmail.com 
> <javascript:>> wrote:
>
>> But why this difficulty while I use in WATIR? Selenium is allowing me to 
>> access without any these kind of trouble. WATIR should eases that the 
>> selenium coding, but here it makes it difficult. 
>>
>>
>> On Friday, July 28, 2017 at 8:20:51 PM UTC+5:30, Titus Fortner wrote:
>>>
>>> Watir should now only send the null value to the frame endpoint if the 
>>> element in question is inside an iframe. So this could make sense. You need 
>>> to include the iframe definition as a parent object whenever defining 
>>> elements inside of it.
>>
>> -- 
>> -- 
>> Before posting, please read http://watir.com/support. In short: search 
>> before you ask, be nice.
>>  
>> watir-...@googlegroups.com <javascript:>
>> http://groups.google.com/group/watir-general
>> watir-genera...@googlegroups.com <javascript:>
>>
>> --- 
>> 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 watir-genera...@googlegroups.com <javascript:>.
>> 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.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to