System.setProperty("webdriver.chrome.driver", "D:\\softwares\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("https://mail.google.com/");
String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,Keys.RETURN);
driver.findElement(By.linkText("www.facebook.com")).sendKeys(selectLinkOpeninNewTab);
New tab is opening but URL link is not opening.
this below code works for me in Selenium 3 and chrome version 58.
I had used the below code to open a new tab in the browser using C# selenium..
You can open multiple browser or a window by using below code:
Selenium can only automate on the WebElements of the browser. Opening a new tab is an operation performed on the webBrowser which is a stand alone application. For doing this you can make use of the Robot class from the java.util.* package which can perform operations using the keyboard regardless of what type of application it is. So here's the code for your operation. Note that you cannot automate stand alone applications using the Robot class but you can perform keyboard or mouse operations
After this step you will need a window iterator to switch to the new tab:
I checked with below code and it works fine for me. I found answer from here.
I have tried other techniques, but none of them worked, also no error produced, but when I have used the code below, it worked for me.