Buy From Flipkart

Wednesday, 11 December 2013

All possible ways for handling frames / iframes using Selenium Webdriver

Following are the possible ways for handling Frames

1.If Frame is having the element properties like name/value
webdriver.switchTo().frame("frame name/value");
2.If Frame is having index
webdriver.switchTo().frame(index);
3.If the Frame Properties or changing dynamically / if u want to perform using frame xpath / css path
webdriver.switchTo().frame(webdriver.findElement(By.xpath(elementxpath));
webdriver.switchTo().frame(webdriver.findElement(By.cssSelector(elementcsspath));
Note: finally if you want to make operation out of the frame first you need get out of the frame following is the statement for that
driver.switchTo().defaultContent();

Please do comment on any queries

Other Popular posts: