Wednesday, July 12, 2017

Multiple window examples


Click this link to start new Tab
Click this link to start new Tab
Click this link to start new Tab
Click this link to start Session in same window

6 comments:

  1. public class GmailChild_parentWindow {

    public static void main(String[] args) throws InterruptedException {
    // TODO Auto-generated method stub

    System.setProperty("webdriver.gecko.driver","C:\\geckodriver-v0.17.0-win64\\geckodriver.exe");

    WebDriver driver= new FirefoxDriver();
    driver.get("https://www.google.com/gmail/about/");
    driver.findElement(By.xpath("html/body/nav/div/a[3]")).click();
    String parent = driver.getWindowHandle();
    Set allwindows = driver.getWindowHandles();
    ArrayList tabs= new ArrayList<>(allwindows);
    System.out.println(driver.switchTo().window(tabs.get(1)));
    System.out.println(driver.getTitle());
    }

    }

    Unable to print the title plz help me

    ReplyDelete
  2. use wait statement like before capture the title thread.sleep(3000);

    ReplyDelete
  3. I really enjoy the blog.Much thanks again. Really Great selenium Online course Hyderabad

    ReplyDelete
  4. It's very informative post and i would like to suggest the best salesforce online training which is job oriented and 100% practical.

    ReplyDelete
  5. I really enjoy the blog.Much thanks again. Really Great selenium Online Training Bangalore

    ReplyDelete