diff --git a/testing/marionette/driver.js b/testing/marionette/driver.js index a628ca60f44a..6494ecff12a4 100644 --- a/testing/marionette/driver.js +++ b/testing/marionette/driver.js @@ -2408,9 +2408,14 @@ GeckoDriver.prototype.takeScreenshot = function (cmd, resp) { switch (this.context) { case Context.CHROME: let canvas; - let container = {frame: this.getCurrentWindow()}; let highlightEls = []; + let container = {frame: this.getCurrentWindow().document.defaultView}; + + if (!container.frame) { + throw new NoSuchWindowError('Unable to locate window'); + } + for (let h of highlights) { let el = this.curBrowser.seenEls.get(h, container); highlightEls.push(el);