From 77f585298f4fa86505817ec46a58b560a162b8e8 Mon Sep 17 00:00:00 2001 From: Schelkun <31924884+schelkun@users.noreply.github.com> Date: Wed, 8 Nov 2017 00:17:36 +0300 Subject: [PATCH] feat(Page): introduce Page bringToFront method (#1252) This patch introduces Page.bringToFront method to activate tabs. Fixes #1244 --- docs/api.md | 7 +++++++ lib/Page.js | 4 ++++ test/test.js | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index 99538f225b3..cfa74d0ba4a 100644 --- a/docs/api.md +++ b/docs/api.md @@ -45,6 +45,7 @@ * [page.addScriptTag(options)](#pageaddscripttagoptions) * [page.addStyleTag(options)](#pageaddstyletagoptions) * [page.authenticate(credentials)](#pageauthenticatecredentials) + * [page.bringToFront()](#pagebringtofront) * [page.click(selector[, options])](#pageclickselector-options) * [page.close()](#pageclose) * [page.content()](#pagecontent) @@ -524,6 +525,12 @@ Provide credentials for [http authentication](https://developer.mozilla.org/en-U To disable authentication, pass `null`. +#### page.bringToFront() + +- returns: <[Promise]> + +Brings page to front (activates tab). + #### page.click(selector[, options]) - `selector` <[string]> A [selector] to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked. - `options` <[Object]> diff --git a/lib/Page.js b/lib/Page.js index 977885f9cf0..2d67d4e9c91 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -544,6 +544,10 @@ class Page extends EventEmitter { return response; } + async bringToFront() { + await this._client.send('Page.bringToFront'); + } + /** * @param {!Object} options */ diff --git a/test/test.js b/test/test.js index c6d49d3df4c..8271fbbb517 100644 --- a/test/test.js +++ b/test/test.js @@ -3118,7 +3118,7 @@ describe('Page', function() { if (process.env.COVERAGE) { describe('COVERAGE', function(){ const coverage = helper.publicAPICoverage(); - const disabled = new Set(); + const disabled = new Set(['page.bringToFront']); if (!headless) disabled.add('page.pdf');