I can open a new window with Selenium WebDriver by using Java and JavaScript. I am using Firefox. The code is as follows:
WebDriver driver = new FirefoxDrive
Wasim,
cdriver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
You can use above line to open new tab in a same browser (Works in Firefox)
It also depends on how your browser is configured to open pop-up's.
There is no standard support in JavaScript or HTML for opening a link in a tab vs a window. It's depending on browser and settings. Some browsers default to opening in new tabs (like Chrome and Safari). Some browser allows the user to configure the behavior. Bottom line, you shouldn't design your site to rely on opening new windows in tabs as there is no reliable and cross-browser compatible mechanism for doing that.
It is mostly depends on your browser settings and there is no separate methods for opening link in new window or new tab