How to change the window position and resize it
solution:------------
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
public class windowhandles {
WebDriver driver;
@Test
public void f() throws AWTException,InterruptedException{
driver.manage().window().setSize(new org.openqa.selenium.Dimension(200,333));
Thread.sleep(2000);
driver.manage().window().setPosition(new org.openqa.selenium.Point(20,40));
Thread.sleep(2000);
driver.manage().window().setPosition(new org.openqa.selenium.Point(234,145));
}
@BeforeTest
public void beforeTest() {
driver=new FirefoxDriver();
driver.get("http://gmail.com");
driver.manage().window().maximize();
}
@AfterTest
public void afterTest() {
driver.quit();
}
}
No comments:
Post a Comment