Taking full page screenshot using Selenium fails with Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)"
Categories
(Remote Protocol :: Marionette, defect, P3)
Tracking
(Not tracked)
People
(Reporter: picchi.lucas, Unassigned)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0
Steps to reproduce:
Using python Selenium navigate to "https://www.youtube.com/watch?v=EzKkl64rRbM" and try to get full page screenshot
Actual results:
Marionette response was
selenium.common.exceptions.WebDriverException: Message: [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://marionette/content/capture.js ::
capture.canvas :: line 140" data: no]
Expected results:
It should have returned a base64 encoded full page screenshot
Reporter | ||
Comment 1•5 years ago
|
||
This piece of python code can reproduce the issue:
# Selenium 4.0.0a3 is the first release to officially support full page screenshot endpoint
# (pip install selenium==4.0.0a3)
from selenium.webdriver import Firefox, DesiredCapabilities, FirefoxProfile
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.firefox.options import Options
import time
profile = FirefoxProfile()
# Allow autoplay
profile.set_preference("media.autoplay.default", 0)
cap = DesiredCapabilities.FIREFOX
options = Options()
options.log.level = "trace"
# options.headless = True
binary = FirefoxBinary("C:\Program Files\Firefox Nightly\\firefox.exe")
webdriver = Firefox(firefox_profile=profile, capabilities=cap, options=options, firefox_binary=binary)
webdriver.get("https://www.youtube.com/watch?v=EzKkl64rRbM")
time.sleep(3)
# This fails
webdriver.save_full_page_screenshot("test.png")
webdriver.quit()
Reporter | ||
Comment 2•5 years ago
|
||
Reporter | ||
Comment 3•5 years ago
|
||
Prior to 1598731 the behavior and error was as described in that bug for FF 60/70/71/72 that's why I'm testing over nigthly release now
Updated•5 years ago
|
Comment 4•5 years ago
|
||
I can see the same intermittently on Mac. When it happens we try to screenshot the following DOM rect (0 0 1280 0)
. That means the height is 0, which isn't an allowed value for drawSnapshot()
. And since bug 1600124 has been fixed we no longer crash.
Right now both width, and height are retrieved from documentElement.getBoundingClientRect()
. So it looks like that there is still some JS activity going on after a page load, which resizes the documentElement. When the test passes I see DOm rects of (0 0 1280 738)
.
I think we should return a better error message when the width or height of the capture area is 0. I will do that as part of bug 1571424.
For now you want to wait anyway until the full page has been loaded, which includes all the AJAX requests being finished.
Comment 5•5 years ago
|
||
Actually this is a dupe of bug 1492357.
Updated•2 years ago
|
Description
•