Monday, 17 March 2014

How to handle frames in Selenium Webdriver in C#.Net?

To work with frames we need to switch to the frame and then perform the operation inside it. We can switch to the frame using 3 ways in C# selenium API.

  1. Using frame Index
  2. Using frame name
  3. Identifying a frame by any other method like id, class etc.

Sample examples in C#.Net

//Above code will switch to the first frame in web page

e = driver.FindElement(By.Id("bpl"));
//Above code will switch to the frame with id bpl

//Above code will switch to the frame having name - f1.

Once you switch to the desired frame, you can do rest of the operations the same way as you do in single document page.

What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at

No comments:

Post a Comment

Buy Best Selenium Books