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 <[email protected]>
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.
>
> [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.

Reply via email to