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:
Henrik Skupin 2016-12-07 17:38:14 +01:00
Родитель f744b6d129
Коммит 42387e6802
1 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -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 {