w3c / w3c/webdriver

Absolute positioned elements not taken into account for screenshot dimension

Open
#1,443 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Take Screenshot
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

With the issue for geckodriver filed by @juangj already 2 years ago we still have the problem in how to determine the correct screenshot dimension when elements have an absolute position, which means that they can be located outside of the documentElement's bounds.

In chapter 17. Screen capture, section 17.1 Take Screenshot:

Let root rect be the current top-level browsing context’s document element’s rectangle

Given the spec we never would be able to get those elements drawn as part of the screenshot. And in some cases the root element can have a zero height, which means the result is a empty screenshot with only some pixels in height.

The example as given on the other issue is:

<div style="position: absolute; width: 200px; height: 200px; background-color: blue;"></div>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WebDriver specification's section 17.1, Take Screenshot, and compare its document-element rectangle rule with the linked geckodriver issue and the absolute-positioned HTML example. Determine and document the intended screenshot bounds for content outside the document element, including zero-height roots; completion requires an agreed specification change.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
testing-qa, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.