InterviewSolution
Saved Bookmarks
| 1. |
We know that we can maximize or minimize the browser window. However, we need to test the responsiveness of the UAT in different browser screen sizes. Can this be done in Selenium? |
|
Answer» Yes, this can be done in Selenium. We can resize the browser window to a particular dimension using the setSize() method. We can customize the screen size by bypassing the desired width and height of the screen size in the parameters. int width = 600;int height = 400; Dimension dimension = new Dimension(width, height); driver.manage().window().setSize(dimension); window.resizeTo() method and capability commands can also be used to achieve the same result. Use windows.resizeTo() method along with Javascript executor. ((JavascriptExecutor)driver).executeScript("window.resizeTo(600,400);"); |
|