How do I open a new tab on chrome. I need get some data from it, get back to my previous tab and input the data. I know how to iterate through the tabs, but I am not able to open a new tab.
Selenium version : 3.5.2
Chrome version : 60
package Amazon;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class VerifyAmazonSignInPage {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "C://Selenium jars/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("http://www.amazon.in");
driver.findElement(By.xpath("//span[text()='Hello. Sign in']")).click();
driver.findElement(By.id("ap_email")).sendKeys("seleniumoar1234@gmail.com");
driver.findElement(By.id("ap_password")).sendKeys("*****");
driver.findElement(By.id("signInSubmit")).click();
Actions act = new Actions(driver);
act.keyDown(Keys.CONTROL).sendKeys("t").keyUp(Keys.CONTROL).build().perform();
driver.get("http://www.gmail.com");
}
}