Showing posts with label change the position of the open browser window.. Show all posts
Showing posts with label change the position of the open browser window.. Show all posts

Tuesday, 24 November 2015

How to change the position of the open browser window.

use command -> driver.manage().window().setPosition(new Point(int value1,int value2));

import java.awt.AWTException;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class MoveWindow
{
public static void main(String[] args) throws InterruptedException, AWTException
{
    WebDriver driver = new FirefoxDriver();
    driver.manage().window().setPosition(new Point(0,0)); //move the window to top right corner 
    Thread.sleep(2000);
    driver.manage().window().setPosition(new Point(500,400)); //move the window to 500unit horizontally and 400unit vertical
 }
}