Open New Tab with New URL Using Webdriver

import java.util.ArrayList;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class TableCheckbox
{
   public static void main(String a[])
   {
  WebDriver driver=new FirefoxDriver();
  driver.get("http://www.google.com");
  driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
  ArrayList<String> tabs = new ArrayList<String> (driver.getWindowHandles());
  driver.switchTo().window(tabs.get(0));
  driver.get("http://www.gmail.com");

   }

}

Post a Comment

0 Comments