Selenium Webdriver Appium Complete TutorialSelenium Webdriver Appium Complete Tutorial
Automation Testing
  • Tools
    • Selenium
      • Selenium Java Tutorial
      • Selenium C# Tutorial
    • Appium
      • Appium Java Tutorial
      • Appium C#Tutorial
    • Katalon
  • Trainings
  • TestNG
  • Reports
    • Extent Reports
      • Extent Reports – Java
      • Extent Reports – Java -Version3
      • Extent Reports – C#
    • Vigo Reports
    • AT Excel Report
  • Excel
    • Apache POI – Java
    • Excel With C#
  • Interview Questions
    • Selenium Interview Questions
    • Java Interview Questions
    • C# Interview Questions
  • Demo Site
  • Practice Site
  • More…
    • AutoIt
    • Sikuli
    • Robot Class
    • File Upload
    • ScreenShot
      • AShot
      • ShutterBug
  • About
December 12, 2016

Selenium NoSuchFrameException





Selenium NoSuchFrameException will discuss about one of the frequent exceptions which we will face in selenium webdriver. You might face this kind of exception while automating the application if you have iFrames in your application. In modern applications people are using iFrames very frequently as if you want to show the information from other sources then will use the frames in the application. We will face this kind of exception in different kind of scenarios. Will discuss the reasons for this issue and we will know we can overcome this issue.

Below are the causes to face this exception:

  1. Let’s assume in your application if you have a frame and it contains some elements (for example we will take a textbox in this scenarios) and you want to enter something into that textbox. For this we have captured the locator of the textbox and used the same in the code and everything is correct as per the logic. But after execution of the script we will find NoSuchFrameException. And best part here is selenium will tell us with the proper exception, instead if it says NoSuchElementException then it will be very difficult us to resolve these kind of scenarios.Actually the issue is, if you have frames in your application then you need to switch to that frame first and then only you will be able to interact with the elements which are there inside the frame in selenium.
  2. Let’s assume one more scenario where you have a webpage with more than one frame. We will call them frame A and frame B. We will assume that we first switched to frame B to check/verify something in the frame B. If we then try to find frame A, we will get NoSuchFrameException. This is because frame A does not exist in the context of frame B.

To overcome this issue is to always go back to the parent frame before trying to switch to another frame

If you have a frame inside a frame then you no need to go back to parent content. You can directly switch to that frame. But after completion of all the things which you want to perform inside the frames need to come out of the frames to continue further script capturing and execution.

You can use frame IDs or WebElements to locate the frames and then you can switch to them. You can also use frame indexes to switch to them but use this as a last option.

Please watch the YouTube video for this blog for better understanding.




Share this post: on Twitter on Facebook on Google+

Selenium NoSuchElementException Selenium NoSuchWindowException

Related Posts

TAKING WEB ELEMENT SCREENSHOT IN SELENIUM

Selenium - Java

How to Capture WebElement Screenshot in Selenium Webdriver using selenium 4

avoid Switch to window

Selenium - Java

How to Avoid Switch To Window in Selenium WebDriver

webdrivermanager

Selenium - Java

No More Driver EXE files for Selenium Execution – Instead Use WebDriverManager

HANDLE TEXTBOXES IN SELENIUM

Selenium - Java

Handling Textboxes in Selenium

JAVASCRIPTEXECUTOR IN SELENIUM

Selenium - Java

JavaScriptExecutor in Selenium

ELEMENT NOT VISIBLE EXCEPTION

Selenium - C#, Selenium - Java

Selenium ElementNotVisibleException

NOSUCHWINDOW EXCEPTIONS

Selenium - C#, Selenium - Java

Selenium NoSuchWindowException

NOSUCHELEMENT EXCEPTION

Selenium - C#, Selenium - Java

Selenium NoSuchElementException

SELENIUM WEBDRIVER EXCEPTIONS

Selenium - C#, Selenium - Java

Selenium WebDriver Exceptions

HANDLING BASIC ELEMENTS IN SELENIUM

Selenium - C#, Selenium - Java

Handling Basic Elements in Selenium

Newsletter

Recent Posts

  • TAKING WEB ELEMENT SCREENSHOT IN SELENIUMHow to Capture WebElement Screenshot in Selenium Webdriver using selenium 4
    December 15, 2019
  • How To SWAP Two Numbers in Java Without using Temp VariableHow to SWAP Two Numbers in Java Without Temp variable or Without Third variable
    December 8, 2019
  • How to Swap Two Numbers in Java with Temp VariableHow to SWAP Two Numbers in Java using Temp Variable
    December 1, 2019
  • How to Read Properties file in JavaHow to Read Data From Properties File in Java
    November 27, 2019
  • Compare two arrays in java with out inbuilt functionsHow to Compare Two Arrays in Java without built-in functions
    November 16, 2019
© Selenium Webdriver Appium Complete Tutorial 2023