Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

Can anyone tell me how I can identify and switch to the iframe which has only a title?

<iframe frameborder="0" style="border: 0px none; width: 100%; height: 356px; min-width: 0px; min-height: 0px; overflow: auto;" dojoattachpoint="frame" title="Fill Quote" src="">

I have tried by below code but it is not working


1 Answer

0 votes
by (62.9k points)

You can make use of the CSS Selector or Xpath as shown below:

Approach 1: CSS Selector

driver.switchTo().frame(driver.findElement(By.cssSelector("iframe[title='Fill Quote']")));

Approach 2: Xpath

driver.switchTo().frame(driver.findElement(By.xpath("//iframe[@title='Fill Quote']")));

Check out this link:

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s online automation testing training!

Browse Categories