Thursday, May 16, 2019

Set Dimension of window in Selenium Java

 package secondpackage;  
 import org.openqa.selenium.Dimension;  
 import org.openqa.selenium.WebDriver;  
 import org.openqa.selenium.chrome.ChromeDriver;  
 public class DimensionTest {  
      public static void main(String[] args) {  
           System.setProperty("webdriver.chrome.driver",  
                     "C:\\Users\\Mitturaj.h\\Desktop\\chromedriver_win32\\chromedriver.exe");  
           WebDriver driver = new ChromeDriver();  
           driver.navigate().to("https://www.google.com/");  
           System.out.println(driver.manage().window().getSize());  
           Dimension dimension = new Dimension(500, 500);  
           driver.manage().window().setSize(dimension);  
           System.out.println(driver.manage().window().getSize());  
      }  
 }  


Output


 (945, 1020)  
 (500, 500)  

No comments:

Post a Comment