• public static void main(String[] args) throws InterruptedException
    System.setProperty("", "C://DriversC//chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.switchTo().frame("IF2"); // --> Getting into the frame., 'IF2' is the ID of the frame.
    WebElement findElement = driver.findElement(By.xpath("(//a[@rel='bookmark'])[3]"));;
    driver.switchTo().defaultContent(); // --> Getting out of the frame..
    WebElement findElement2 = driver.findElement(By.xpath("(//img[@class=' preload-me'])[4]"));;

  • In software testing services before working on frames first we need to understand what is a frame. Frame is a part of web page which is embedded in another web page or an HTML document embedded inside another HTML document.

    Below are the ways to switch over the elements in iframes using Web Driver commands:
    By Index:

    • driver.switchTo().frame(0);
    • driver.switchTo().frame(1);

    By Name or Id:

    • driver.switchTo().frame("iframe1");
    • driver.switchTo().frame("id of the element");

    By Web Element:

    • driver.switchTo().frame(WebElement);
    The Best Software Testing Services Company - QASource
    Partner with the leading software testing company, QASource, and accomplish all your software testing goals within strict deadlines and budget. We pr…
This reply was deleted.
    results->result as $result) { ?>
  1. jobtitle;?>
    company;?>(formattedRelativeTime;?>)city;?>, state;?>
    Welcome to Mobile QA Zone, a Next Generation Software Testing Community.Invite your friends to join this community.Write to us to become a featured member.