The part of the code which opens a new tab and opens a url in that new tab does not work. It opens the new tab but opens the new url in the previous tab itself. Can anyone help?
public class PractiseSession1
{
public static void main(String[] args)
{
// TODO Auto-generated method stub
String URL="http://www.google.com";
System.setProperty("webdriver.gecko.driver", "D:\\Sourav Mukherjee\\BP-Oyster\\S2\\Selenium Server\\geckodriver-v0.16.1-win64\\geckodriver.exe");
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(dc);
driver.get(URL);
//Open a url in a new tab
driver.findElement(By.cssSelector("Body")).sendKeys(Keys.CONTROL+ "t");
driver.get("http://facebook.com/");
}
}