I’m using below code to into windows :

    Set<String> handle=driver.getWindowHandles();
    System.out.println(handle);
    Iterator<String> it=handle.iterator();

    String parent=it.next();
    System.out.println("parent  =" +parent);
    String child=it.next();

    System.out.println("second child  =" +child);
    driver.switchTo().(child);
    driver.findElement(By.xpath("//*[@id="fixHeader"]/tbody/tr[2]/td[4]/a/span")).click();

    Thread.sleep(3000);
    String child2=it.next();
    System.out.println("Third child  =" +child2);
    driver.switchTo().(child2); 

But getting below exception :

Exception in thread “main”
org.openqa..NoSuchElementException: no such element: to
locate element: {“method”:”id”,”selector”:”stylenumberH”}



Source link https://sqa.stackexchange.com/questions/35345/unable-to-switch-into-third-window-selenium

LEAVE A REPLY

Please enter your comment!
Please enter your name here