How to Handle Frames in Selenium WebDriver

preview_player
Показать описание
In this video, I have shown how we can handle Frames in Selenium WebDriver.

Frames are a now deprecated means of building a site layout from multiple documents on the same domain. You are unlikely to work with them unless you are working with a pre-HTML5 web app. Iframes allow the insertion of a document from an entirely different domain and are still commonly used.

To interact with any control inside the frame, we will need to first switch to the frame, in a similar way to how we switch windows. WebDriver offers three ways of switching to a frame.
1) Using an index
2) Using a name or ID
3) Using a WebElement

------------ Using an index: ------------------
Here the index starts from 0(zero)

Example:
// Switches to the second frame

------------ Using a name or ID ------------------
If your frame or iframe has an id or name attribute, this can be used instead. If the name or ID is not unique on the page, then the first one found will be switched to.

Example:
//Using the ID

//Or using the name instead

//Now we can click the button

------------ Using a WebElement ------------------
Switching using a WebElement is the most flexible option. You can find the frame using your preferred selector and switch to it.

Example:
//Store the web element

//Switch to the frame

//Now we can click the button

--------------- Leaving a frame ------------------------
To leave an iframe or frameset, switch back to the default content like so:

Example:
// Return to the top level

---------------- Going to parent frame ------------------
When you are in nested frames and you want to come back to the parent frame of all the child frames then we use a method called parentframe.

Example:

//Return to parent frame

==============================================
************** Checkout my other playlists **************
==============================================
Java Programming videos playlist:👇

Selenium WebDriver with Java videos playlist:👇

Selenium interview questions videos playlist:👇

Windows automation with FlaUI videos playlist:👇

CSS Selectors videos playlist:👇

XPath videos playlist:👇

Javascript Executor videos playlist:👇

Apache POI videos playlist:👇

Maven videos playlist:👇

How to fix Eclipse errors:👇
==============================================
==============================================
Connect us @
==============================================
==============================================
🙏 Please Subscribe🔔 to start learning for FREE now, Also help your friends in learning the best by suggesting this channel.

#webAutomation #selenium #frames #hyrtutorials
Рекомендации по теме
Комментарии
Автор

Please use the below link for the selenium videos playlist:

HYRTutorials
Автор

Thank you. You explain patiently & with sincerity. Thanks again.

angaraki
Автор

It's one of kind of Website you created is superb work to understand the concept, i have to say tons of thanks

saxenahimanshu
Автор

Обожаю туторы этого прекрасного народа. Мемы мемами, а полезность коллосальная. :)

RandomFromInternet
Автор

Thanks for the explanation, you made my day.

marsoniyahem
Автор

Explained in very good manner.
Thank you Comrade.

syedsharoz
Автор

Excellent explanation sir, I had a fear to automate frames, but you recovered me from this. Thank you so much

subhasrinayak
Автор

Awesome. Thanks a lot for the very clear explanation

ChethanCP
Автор

really so help full, crystal clear explanation thank you sir

sulthanarazia
Автор

thank you, i can understand it very well now

lightinlight
Автор

Learning a lot from ur videos...clear explanation..thanks for sharing the videos....waiting for CSS selector videos..👍

tgrakeshgmail
Автор

If you find this video is not clear, you can watch this video with good, the link is in 1st comment.


The content of the video is good, explained in simple way

factsofallahal-shaheedserv
Автор

Hey H Y R Tutorial
Your lecture is very Impressive
Thank you for your effort
Have a good one

HafizurRahman-drxe
Автор

Brilliant explanation 🙂, I have a question, can we handle the elements inside the frames using javascript executor interface ??

chirunomulavenkatesh
Автор

Hi I would like to know if you are conducting some training sessions for Java + Selenium automation testing?

rvj
Автор

I have observed one small thing, if we are using thread.sleep, then frame switching with index will not work but frame switching with id or name will work; is this a known issue

Narain
Автор

what is difference between frame and iframe ? is it different

SiddharthKaleFilms
Автор

Nice Explanation. Is it possible to calculate the time load for iframe using javascript or listeners?

purvidholakia
Автор

Excellent video. Please give code of program

जिंदगी_ए_सफर
Автор

can we use switchto default content while handling windows

swapnabhaskaruni