I want to open a new tab in IE and then open a URL in that new tab and do some operation there and then close that tab.
So, I used the below code and it is working fine with firefox
driver.get("http://google.com");
driver.findElement(By.tagName("body")).sendKeys(Keys.CONTROL,"t"); // opens a new tab
driver.get("http://facebook.com");
driver.findElement(By.tagName("body")).sendKeys(Keys.CONTROL,"w"); // closes that new tabBut the above code doesn't work with IE.
What it does is that it opens a new tab, but after that it opens the 2nd url in the parent tab while the new tab is in focus. And at the end it closes the new tab.
So, please help me in finding a solution for it so that the 2nd url opens up in a new tab in IE.