When I take the screenshot of any application in AWS, the Screenshot size is very very small. How do i increase the size of the Screenshot

Viewed 40
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);

We are running in headless mode in AWS. The screen shot is getting proper when I do in Windows but not in AWS when I do Selenium Automation. After write to ZOOM the running for open in big screen but it is not working,

JavascriptExecutor jse = (JavascriptExecutor)driver;
Thread.sleep(3000);
jse.executeScript("document.body.style.zoom='100%'");

I expecting the screenshot as shown on the Browser.

1 Answers

Try Setting dimensions of window and it will solve your problem:

WebDriver driver = new ChromeDriver(options);
//Setting dimensions of window
driver.manage().window().setSize(new Dimension(1250,800));

Dimension:

Selenium provides a class named Dimension which can be used to get the current size of the browser window and set the new size of the browser window.

Related