Sunday, October 25, 2020

Handling frames!!!


Developing page inside another web page is called 'Embedded web page' or 'Nested web page'. To develop the frame, developer will use frame tag.
If the element is present inside the frame if we want to perform action on the element, first we should switch control from page to frame by using below statement:
driver.switchTo().frame();

frame() is overloaded i.e., frame(int arg()) ---- By index
                                          frame(String arg()) -By ID
                                          frame(WebElement args())-By frame element
To switch back control from frame to page , we use below statement:
driver.switchTo().defaultContent();

Important point to deal with frames:
1.To switch from control from child frame to parent frame, we use
    driver.switchTo().parentframe();
2.To verify whether element is inside the frame, right click on element and check whether it displays 
    frame option, if it is then element is present inside the frame.
3.Before switching the control from page to frame, if we perform then we get 
   "NO SUCH ELEMENT EXCEPTION" 
4. If the selenium code is unable to find the frame on the web page to switch i.e., if the driver is                  switching  to invalid frame we get "NO SUCH FRAME EXCEPTION".

Thanks for reading!!!
Happy Testing!!!

5 comments:

  1. Thank You sri priya...Nice Tutorial..👍

    ReplyDelete
  2. The data you have given in this blog is particularly one of a variety and relevant. I will transfer this blog to my associates. I want you to continue presenting such data to us in the future also. Thankful for bestowing a particularly unbelievable blog. This will solve the difficulties of several people. Apart from this, if you want to take any kind of web design service, then you can take the help of Website Design Ireland. They are doing phenomenal work in this field for the last many years. Visit the website for more information.

    ReplyDelete
  3. Wow, I really loved this page. As a beginner, it really empowered me a lot.
    discover here

    ReplyDelete
  4. Thanks for sharing such a amazing information I hope you will keep providing more information
    read here

    ReplyDelete
  5. Hello this post was extremely interesting, particularly because I was looking for thoughts on thipz topics
    next page

    ReplyDelete