Skip to content

Commit

Permalink
feat(Page): introduce Page bringToFront method (puppeteer#1252)
Browse files Browse the repository at this point in the history
This patch introduces Page.bringToFront method to activate tabs.

Fixes puppeteer#1244
  • Loading branch information
schelkun authored and aslushnikov committed Nov 7, 2017
1 parent 9de3449 commit 77f5852
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]>
Expand Down
4 changes: 4 additions & 0 deletions lib/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@ class Page extends EventEmitter {
return response;
}

async bringToFront() {
await this._client.send('Page.bringToFront');
}

/**
* @param {!Object} options
*/
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit 77f5852

Please sign in to comment.