diff --git a/lib/controllers.js b/lib/controllers.js index ac8e7ba..98f28ee 100644 --- a/lib/controllers.js +++ b/lib/controllers.js @@ -243,11 +243,11 @@ controllers.takeElementScreenshot = async function(elementId, params = {}) { * @return {Promise.} */ controllers.findElement = async function(strategy, selector, ctx) { - return await findElementOrElements.call(this, strategy, selector, ctx, false); + return findElementOrElements.call(this, strategy, selector, ctx, false); }; controllers.findElements = async function(strategy, selector, ctx) { - return await findElementOrElements.call(this, strategy, selector, ctx, true); + return findElementOrElements.call(this, strategy, selector, ctx, true); }; /** @@ -258,7 +258,7 @@ controllers.findElements = async function(strategy, selector, ctx) { */ controllers.getText = async function(elementId) { const element = this.elements[elementId]; - return await element.innerText(); + return element.innerText(); }; /** @@ -299,7 +299,7 @@ controllers.setValue = async function(elementId, value) { */ controllers.isDisplayed = async function(elementId) { const element = this.elements[elementId]; - return await element.isVisible(); + return element.isVisible(); }; /** @@ -310,7 +310,7 @@ controllers.isDisplayed = async function(elementId) { */ controllers.getProperty = async function(elementId, attrName) { const element = this.elements[elementId]; - return await element.getAttribute(attrName); + return element.getAttribute(attrName); }; /** @@ -320,7 +320,7 @@ controllers.getProperty = async function(elementId, attrName) { * @return {Promise.} */ controllers.title = async function() { - return await this.page.title(); + return this.page.title(); }; /** @@ -363,7 +363,7 @@ controllers.execute = async function(script, args) { * @return {Promise.} */ controllers.url = async function() { - return await this.page.url(); + return this.page.url(); }; /** @@ -412,7 +412,7 @@ controllers.back = async function() { * @return {Promise} */ controllers.getWindows = async function() { - return await this.page.frames(); + return this.page.frames(); }; /** @@ -460,7 +460,7 @@ controllers.setWindowSize = async function(windowHandle, width, height) { * @return {Promise.} */ controllers.maximize = async function(windowHandle) { - return await this.setWindowSize(windowHandle, 1920, 1080); + return this.setWindowSize(windowHandle, 1920, 1080); }; /** @@ -471,7 +471,7 @@ controllers.maximize = async function(windowHandle) { */ controllers.refresh = async function() { this.frame = null; - return await this.page.reload(); + return this.page.reload(); }; /** @@ -482,7 +482,7 @@ controllers.refresh = async function() { */ controllers.getSource = async function() { const cmd = 'return document.getElementsByTagName(\'html\')[0].outerHTML'; - return await this.execute(cmd); + return this.execute(cmd); }; /** @@ -493,14 +493,9 @@ controllers.getSource = async function() { */ controllers.getScreenshot = async function(context, params = {}) { if (params.video) { - return await this.page.video()?.path?.() || null; + return this.page.video()?.path?.() || null; } - if (params.fullPage) { - params.fullPage = params.fullPage === 'true'; - } - const image = await this.page.screenshot(Object.assign({ - fullPage: true, - }, params)); + const image = await this.page.screenshot(params); const base64 = image.toString('base64'); if (params.dir) { @@ -522,7 +517,7 @@ controllers.getScreenshot = async function(context, params = {}) { controllers.getComputedCss = async function(elementId, propertyName) { const element = this.elements[elementId]; /* istanbul ignore next */ - return await this.page.evaluate(([ element, propertyName ]) => window.getComputedStyle(element)[propertyName], [ element, propertyName ]); + return this.page.evaluate(([ element, propertyName ]) => window.getComputedStyle(element)[propertyName], [ element, propertyName ]); }; /** @@ -532,7 +527,7 @@ controllers.getComputedCss = async function(elementId, propertyName) { * @return {Promise.} */ controllers.getAllCookies = async function() { - return await this.browserContext.cookies(); + return this.browserContext.cookies(); }; /** @@ -542,7 +537,7 @@ controllers.getAllCookies = async function() { * @return {Promise.} */ controllers.getNamedCookie = async function() { - return await this.browserContext.cookies(); + return this.browserContext.cookies(); }; /** @@ -600,7 +595,7 @@ controllers.setContext = async function(name) { controllers.getRect = async function(elementId) { const element = this.elements[elementId]; - return await element.boundingBox(); + return element.boundingBox(); }; /** @@ -609,7 +604,7 @@ controllers.getRect = async function(elementId) { */ controllers.next = async function(method, args = []) { assert(method, 'method name is required'); - return await nextActions[method].call(this, ...args); + return nextActions[method].call(this, ...args); }; module.exports = controllers; diff --git a/package.json b/package.json index 84e6b15..8be341b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "macaca-playwright", - "version": "1.11.0", + "version": "1.11.1", "description": "Macaca Playwright driver", "keywords": [ "playwright",