简体   繁体   English

如何筛选完全垂直的尺寸和完全水平的尺寸?

[英]How can I screen a full vertical size with exactly horizontal size?

I use a Selenium with the Ashot framework to make screenshots of the entire page 我将Selenium与Ashot框架配合使用来制作整个页面的屏幕截图

ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
options.addArguments("disable-infobars");
options.addArguments("--disable-extensions");
WebDriver driver = new ChromeDriver(options);


Screenshot screenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(100)).takeScreenshot(driver);

This shooting strategy works fine, I can get the full-sized screenshot. 这种拍摄策略效果很好,我可以获得完整尺寸的屏幕截图。 I received the screenshot with 1200 width x Full Size of my webpage, but I need to screenshot my webpage with different width sizes, for example, 1920xFullSize, 1280xFullSize etc. I tried to use Dimension to set exactly width: 我收到了屏幕宽度为1200 x完整尺寸的屏幕截图,但是我需要使用不同的宽度尺寸(例如1920xFullSize,1280xFullSize等)来截图我的网页。我尝试使用Dimension来精确设置宽度:

Dimension d = new Dimension(1920,720 );
driver.manage().window().setSize(d);

but if I use a Dimension, the entire vertical size screenshot doesn't work and I receive 1920x720 image. 但是如果使用尺寸,则整个垂直尺寸的屏幕截图都无法使用,并且会收到1920x720的图像。

How can I screenshot 1920xFullSize, 1280xFullSize etc? 如何截屏1920xFullSize,1280xFullSize等?

我在设置所需尺寸的Docker容器中使用了Selenium Grid。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM