jueves, 28 de enero de 2016

Selenium / Java - How to resize the browser window

Hi!
For this trick we need to initialize a WebDriver and then the following lines:

Dimension dimension = new Dimension(width, height);
driver.manage().window().setSize(dimension);

NOTE: width and height should be int numbers.

You can actually create a separate method, like this:

public void resize(int w, int h)
{
        Dimension dimension = new Dimension(w, h
);
        driver.manage().window().setSize(dimension);

}

Share this article with a friend!

No hay comentarios.:

Publicar un comentario