зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1243415 - Add support to take full screenshots in chrome scope. r=automatedtester
MozReview-Commit-ID: 1FmWTEZzt7 --HG-- extra : rebase_source : 34ba86cdfcd400eb4f268a0b3d17be95b2f71c3d
This commit is contained in:
Родитель
e4153d09c5
Коммит
c4fb446f19
|
@ -2395,6 +2395,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.
|
||||
*
|
||||
|
@ -2409,6 +2412,7 @@ GeckoDriver.prototype.takeScreenshot = function (cmd, resp) {
|
|||
|
||||
switch (this.context) {
|
||||
case Context.CHROME:
|
||||
let canvas;
|
||||
let container = {frame: this.getCurrentWindow()};
|
||||
let highlightEls = [];
|
||||
|
||||
|
@ -2417,7 +2421,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 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче