public class Demo {
public static void main(String[] args) {
FirefoxDriver driver = new FirefoxDriver();
//打开百度首页
driver.get(“http://www.baidu.com”);
driver.findElement(By.id(“kw”)).sendKeys(“selenium”);
driver.findElement(By.cssSelector("#su")).click();
//设置浏览器尺寸
Dimension dimension = new Dimension(400, 400);
driver.manage().window().setSize(dimension);
//获取浏览器尺寸
Dimension size = driver.manage().window().getSize();
System.out.println(size);
//获取浏览器位置
Point position = driver.manage().window().getPosition();
System.out.println(position);
//设置浏览器位置
Point p = new Point(100,0);
driver.manage().window().setPosition§;
//driver.quit();
}
}
标签:浏览器,Point,selenium,manage,driver,window,new,Java
来源: https://blog.csdn.net/weixin_38102592/article/details/90204547