Automation QA Testing Course Content

how to maximize the window in Selenium WebDriver

We can maximize the window in Selenium in Two ways

driver.manage().window().maximize();

driver.manage().window().fullScreen();

How to set the position of the window 
Ans: setPosition(Point args);
Syntax:
driver.manage().window().setPosition(new Point(xcoordinate,y coordinatevalue));

How to resize the window/Set window size?
?
Ans: setSize(Dimension args);
syntax:
driver.manage().window().setSize(new Dimension(height,width));

How can you get the window position?
Ans: getPosition(); returns Point object
Point p=driver.manage().window().getPosition();

x coordinate : p.getX() y coordinate value=p.getY();

How can you get the size of the widnow/browser?
Ans: getSize(); returns Dimension Object
Dimension d=driver.manage().window().getSize();
height value=d.getHeight();
widthValue=d.getWidth();


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.