Sample Program:
package Name;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.Test;
public class MultiWindowHandle {
WebDriver driver;
@Test
public void test2() throws Exception{
driver = new FirefoxDriver();
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
Thread.sleep(2000);
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
new Actions(driver).sendKeys(Keys.CONTROL,Keys.NUMPAD1).perform();
}
}
package Name;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.Test;
public class MultiWindowHandle {
WebDriver driver;
@Test
public void test2() throws Exception{
driver = new FirefoxDriver();
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
Thread.sleep(2000);
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
new Actions(driver).sendKeys(Keys.CONTROL,Keys.NUMPAD1).perform();
}
}
0 comments:
Post a Comment