Closed Bug 1604777 Opened 5 years ago Closed 5 years ago

Taking full page screenshot using Selenium fails with Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)"

Categories

(Remote Protocol :: Marionette, defect, P3)

72 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1492357

People

(Reporter: picchi.lucas, Unassigned)

References

Details

Attachments

(2 files)

Attached file geckodriver.log using latest nightly (deleted) —

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

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()
Depends on: 1598731
OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64

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

Component: Page → Marionette
Priority: -- → P3
Product: Remote Protocol → Testing

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.

Status: UNCONFIRMED → NEW
Depends on: 1571424
Ever confirmed: true
OS: Windows 10 → Unspecified
Hardware: x86_64 → Unspecified

Actually this is a dupe of bug 1492357.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: