最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Selenium: what is the difference between different resolutions in Chrome headless mode? - Stack Overflow

programmeradmin1浏览0评论

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 1
Add a comment  | 

1 Answer 1

Reset to default 0

When 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.

发布评论

评论列表(0)

  1. 暂无评论