How to locate a frame in webdriver? OR How to switch from one Frame to another?
Question
How to locate a frame in webdriver? OR How to switch from one Frame to another?
Answer
Select iframe by id
driver.switchTo().frame(“ID of the frame”);
Locating iframe using tagName
driver.switchTo().frame(driver.findElements(By.tagName(“iframe”).get(0));
Locating iframe using index
//frame(index)
driver.switchTo().frame(0);
frame(Name of Frame)
driver.switchTo().frame(“name of the frame”);
📲 Practice Offline on Mobile: Download the free QA Automation & SDET Prep app on Google Play & App Store.