Every line of 'puppeteer page evaluate' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
184 async evaluateValue_(fn, ...args) { 185 const value = await this.evaluate(fn, ...args); 186 const json = await value.jsonValue(); 187 return json.value; 188 }
22 public async click(element: ElementHandle): Promise { 23 await element.click(); 24 }
108 public async waitFor(selector: string | EvaluateFn, options?: WaitForSelectorOptions, ...args: Array): Promise { 109 await this.page.waitFor(selector, options, ...args); 110 }
54 public async waitForSelector(selector: string) { 55 return this.page.waitForSelector(selector) 56 }
50 public async click(selector: string) { 51 return this.page.click(selector) 52 }
22 public async click(): Promise { 23 return this.elementHandle.click(); 24 }
19 runScript(pageFunction, ...args) { 20 let parsedFn 21 if (typeof pageFunction === 'function') { 22 parsedFn = parseFunction(pageFunction, args, this.getBabelPresetOptions()) 23 } else { 24 parsedFn = pageFunction 25 } 26 27 // It would be bettter to return undefined when no el exists, 28 // but selenium always returns null for undefined so better to keep 29 // the return value consistent 30 return this.page.evaluate( 31 /* istanbul ignore next */ 32 function (fn, ...args) { 33 return (new (Function.bind.apply(Function, fn))()).apply(null, [].concat(args)) 34 }, 35 [null, ...parsedFn.args, parsedFn.body], 36 ...args 37 ) 38 }