如何筛选完全垂直的尺寸和完全水平的尺寸? [英] How can I screen a full vertical size with exactly horizontal size?
问题描述
我将Selenium与Ashot框架结合使用来制作整个页面的屏幕截图
I use a Selenium with the Ashot framework to make screenshots of the entire page
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);
此拍摄策略效果很好,我可以获得完整尺寸的屏幕截图. 我收到了屏幕宽度为1200 x完整尺寸的屏幕截图,但是我需要以不同的宽度尺寸(例如1920xFullSize,1280xFullSize等)来截图我的网页. 我尝试使用尺寸来精确设置宽度:
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:
Dimension d = new Dimension(1920,720 );
driver.manage().window().setSize(d);
但是,如果我使用尺寸",则整个垂直尺寸的屏幕截图都无法使用,并且会收到1920x720的图像.
but if I use a Dimension, the entire vertical size screenshot doesn't work and I receive 1920x720 image.
如何截屏1920xFullSize,1280xFullSize等?
How can I screenshot 1920xFullSize, 1280xFullSize etc?
推荐答案
我在设置所需尺寸的Docker容器中使用了Selenium Grid.
I used the Selenium Grid in Docker container where I set the dimensions I need.
这篇关于如何筛选完全垂直的尺寸和完全水平的尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!