We are running PC-Web automation with headless mode, the default resolution ratio is low, and the automation screenshot can not shows all the contents.
After I add_argument("window-size=3840x2160");
, the automation screenshot can full shows all the content.
My question is: what is the difference between different resolutions in Chrome Headless mode?
Is there any impact on performance, efficiency, or case stability in different resolutions?
We are running PC-Web automation with headless mode, the default resolution ratio is low, and the automation screenshot can not shows all the contents.
After I add_argument("window-size=3840x2160");
, the automation screenshot can full shows all the content.
My question is: what is the difference between different resolutions in Chrome Headless mode?
Is there any impact on performance, efficiency, or case stability in different resolutions?
Share Improve this question edited Mar 19 at 6:49 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Mar 19 at 6:39 Jake LiJake Li 11 Answer
Reset to default 0When working with the selenium browser, the window-size does matter for some Selenium functionality. Some examples:
Some pages may have dynamically/lazy-loaded content that doesn't loads until it is 'scrolled into view'. This can in many cases be solved by scrolling down, or scrolling to the specific container holdings the web-elements with functions such as
driver.executeScript("arguments[0].scrollIntoView(true);", element)
Depending on the layout, the website may be responsive and load different UI elements, such as when comparing mobile to desktop view.
Other functions such as
driver.save_screenshot()
,WebElement.isDisplayed()
,WebElement.isVisible()
may depend on the window size.