I was opening a new browser tab through Selenium Webdriver but the new tab I opened was blank. I tried to pass the website link to the Webdriver object, but the link is still not opening.
Here is my code:
// Assuming path is already set
WebDriver driver = new ChromeDriver();
String url1 = "https://www.facebook.com/";
driver.get(url1);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
Robot r = new Robot();
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_T);
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_T);
Set<String> s1 = driver.getWindowHandles();
Iterator itr = s1.iterator();
String parent_window = (String) itr.next();
System.out.println(parent_window + "....." + driver.getTitle());
String child_window = (String) itr.next();
driver.switchTo().window(child_window);
driver.navigate().to("https://www.facebook.com/");