"WebDriver:TakeScreenshot" doesn't work on pages with absolutely positioned elements
Categories
(Remote Protocol :: Marionette, defect, P3)
Tracking
(Not tracked)
People
(Reporter: alexikam, Unassigned)
References
()
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
Steps to reproduce:
I am trying to take a screenshot of full page using the https://github.com/deepsweet/foxr
However, I got an empty image.
Apparently the issue in not on the foxr side, since I also tried to implement screenshots using the marionette in the https://github.com/DevExpress/testcafe. An the result was the same.
There is no issue when I take a not full page screenshot.
Here is my markup:
<!DOCTYPE html>
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
}
body {
background-color: black;
}
div.d {
width: 50px;
height: 50px;
position: absolute;
}
.right {
margin-left: 5000px;
}
.bottom {
margin-top: 5000px;
}
.red {
background-color: rgb(255, 0, 0);
}
.green {
background-color: rgb(0, 255, 0);
}
</style>
</head>
<body>
<div class="d left top red"></div>
<div class="d right top green"></div>
<div class="d left bottom green"></div>
<div class="d right bottom red"></div>
</body>
</html>
And here is foxr script:
```JS
const foxr = require('foxr').default;
(async () => {
try {
const browser = await foxr.connect();
const page = await browser.newPage()
await page.goto('http://127.0.0.1:8080/full-page.html');
await page.screenshot({ path: 'example.png' })
await browser.close()
} catch (error) {
console.error(error)
}
})()
Actual results:
I got an empty image
Expected results:
Image should not be empty.
Comment 1•5 years ago
|
||
Hi @alexikam, for now I will set a component if isn't the right one please fell free to change it.
Regards,
Liviu
Comment 2•5 years ago
|
||
Basically similar to https://github.com/mozilla/geckodriver/issues/931 which already reported that a while ago, but we never filed a bug about it.
Currently we only take the documentElement's dimensions into account, which in the above case are close to zero, and as such the screenshot is empty. And that is what the WebDriver spec covers: https://w3c.github.io/webdriver/#take-screenshot
Do other drivers behave differently? For me it feels it would need an issue on https://github.com/w3c/webdriver/issues/ for discussion.
@Henrik
Thanks for your response.
Yes, this issue is similar.
To be honest I do not know on how other drivers behave. However, I understood your explanation, so ok.
Comment 4•5 years ago
|
||
Ok, so this is blocked on an agreement for https://github.com/w3c/webdriver/issues/1443.
Comment 6•5 years ago
|
||
The priority flag is not set for this bug.
:automatedtester, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•5 years ago
|
Comment 7•5 years ago
|
||
Testing the above example with a non-fullscreen capture it is working fine since Firefox 70, which means it was fixed by my fix for bug 1559592. Only fullscreen is still broken, but will be fixed with bug 1571424, which will be available later today in Nightly.
It might be good to get two webdriver tests added for it once the dependencies have been fixed.
Comment 8•5 years ago
|
||
Actually the behavior change might be inappropriate for non-fullscreen captures. We will have to wait for a conclusion on https://github.com/w3c/webdriver/issues/1443.
Updated•2 years ago
|
Updated•2 years ago
|
Description
•