From 1108b63d82c145e1d86b7d722f27070c1ba2a29b Mon Sep 17 00:00:00 2001 From: TASNEEM KOUSHAR Date: Wed, 2 Jun 2021 18:17:20 +0530 Subject: [PATCH] chore(docs): add comments to page.ts * fix: modified comment for method product, platform and newPage * fix: added comment for browsercontext, StartCSSCoverage, StartJSCoverage * fix: corrected comments for JSONValue, asElement, evaluateHandle * fix: corrected comments for JSONValue, asElement, evaluateHandle * fix: added comments for some of the method * fix: added proper comments * fix: added comment for some methods in page.ts * fix: rectified the comments * fix: changed some of the comments Co-authored-by: Jack Franklin --- src/common/Page.ts | 62 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/src/common/Page.ts b/src/common/Page.ts index 7119ce6759f..4a2ecae2d63 100644 --- a/src/common/Page.ts +++ b/src/common/Page.ts @@ -694,14 +694,14 @@ export class Page extends EventEmitter { } /** - * @returns The browser this page belongs to. + * Get the browser the page belongs to. */ browser(): Browser { return this._target.browser(); } /** - * @returns The browser context that the page belongs to + * Get the browser context that the page belongs to. */ browserContext(): BrowserContext { return this._target.browserContext(); @@ -1085,12 +1085,27 @@ export class Page extends EventEmitter { return this.mainFrame().$$eval(selector, pageFunction, ...args); } + /** + * The method runs `document.querySelectorAll` within the page. If no elements + * match the selector, the return value resolves to `[]`. + * @remarks + * Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }. + * @param selector - A `selector` to query page for + */ async $$( selector: string ): Promise>> { return this.mainFrame().$$(selector); } + /** + * The method evaluates the XPath expression relative to the page document as + * its context node. If there are no such elements, the method resolves to an + * empty array. + * @remarks + * Shortcut for {@link Frame.$x | Page.mainFrame().$x(expression) }. + * @param expression - Expression to evaluate + */ async $x(expression: string): Promise { return this.mainFrame().$x(expression); } @@ -1148,6 +1163,13 @@ export class Page extends EventEmitter { await this._client.send('Network.setCookies', { cookies: items }); } + /** + * Adds a `