mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-01 11:27:55 +00:00
Bug 1243415 - Add support to take full screenshots in chrome scope. r=automatedtester
MozReview-Commit-ID: 1FmWTEZzt7 --HG-- extra : rebase_source : 65de651c36c665a6b14abfc35cc1e47c3ce84152
This commit is contained in:
parent
f744b6d129
commit
42387e6802
@ -2390,6 +2390,9 @@ GeckoDriver.prototype.clearImportedScripts = function*(cmd, resp) {
|
||||
* Reference to a web element.
|
||||
* @param {string} highlights
|
||||
* List of web elements to highlight.
|
||||
* @param {boolean} full
|
||||
* True to take a screenshot of the entire document element. Is not
|
||||
* considered if {@code id} is not defined. Defaults to true.
|
||||
* @param {boolean} hash
|
||||
* True if the user requests a hash of the image data.
|
||||
*
|
||||
@ -2404,6 +2407,7 @@ GeckoDriver.prototype.takeScreenshot = function (cmd, resp) {
|
||||
|
||||
switch (this.context) {
|
||||
case Context.CHROME:
|
||||
let canvas;
|
||||
let container = {frame: this.getCurrentWindow()};
|
||||
let highlightEls = [];
|
||||
|
||||
@ -2412,7 +2416,22 @@ GeckoDriver.prototype.takeScreenshot = function (cmd, resp) {
|
||||
highlightEls.push(el);
|
||||
}
|
||||
|
||||
let canvas = capture.viewport(this.getCurrentWindow(), highlightEls);
|
||||
// viewport
|
||||
if (!id && !full) {
|
||||
canvas = capture.viewport(container.frame, highlightEls);
|
||||
|
||||
// element or full document element
|
||||
} else {
|
||||
let node;
|
||||
if (id) {
|
||||
node = this.curBrowser.seenEls.get(id, container);
|
||||
} else {
|
||||
node = container.frame.document.documentElement;
|
||||
}
|
||||
|
||||
canvas = capture.element(node, highlightEls);
|
||||
}
|
||||
|
||||
if (hash) {
|
||||
return capture.toHash(canvas);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user