You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the following code,I can change element data-page arrribute to 100。 await page.$eval(' div.panel-footer > div > div > ul > li:nth-child(3) > a ',e => e.setAttribute("data-page","100"));
But if I change 100 to a variable, like this ,it will report a error
var currentPageNo = "100" await page.$eval(' div.panel-footer > div > div > ul > li:nth-child(3) > a ',e => e.setAttribute("data-page",currentPageNo ));
node:4780) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: currentPageNo is not defined at __puppeteer_evaluation_script__:1:20 at ExecutionContext.evaluateHandle (\node_modules\puppeteer\lib\ExecutionContext.js:121:13) at process._tickCallback (internal/process/next_tick.js:68:7) -- ASYNC -- at ExecutionContext.<anonymous> (\node_modules\puppeteer\lib\helper.js:108:27) at ExecutionContext.evaluate (\node_modules\puppeteer\lib\ExecutionContext.js:48:31) at ExecutionContext.<anonymous> (\node_modules\puppeteer\lib\helper.js:109:23) at ElementHandle.$eval (\node_modules\puppeteer\lib\JSHandle.js:419:50) at process._tickCallback (internal/process/next_tick.js:68:7) -- ASYNC -- at ElementHandle.<anonymous> (\node_modules\puppeteer\lib\helper.js:108:27) at DOMWorld.$eval (\node_modules\puppeteer\lib\DOMWorld.js:149:21) -- ASYNC -- at Frame.<anonymous> (\node_modules\puppeteer\lib\helper.js:108:27) at Page.$eval (\node_modules\puppeteer\lib\Page.js:329:29) at Page.<anonymous> (\node_modules\puppeteer\lib\helper.js:109:23) at Object.switchToCurrentPageByClick (\functions\sh_common.js:43:23) (node:4780) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:4780) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The text was updated successfully, but these errors were encountered:
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.
We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!
Use the following code,I can change element data-page arrribute to 100。
await page.$eval(' div.panel-footer > div > div > ul > li:nth-child(3) > a ',e => e.setAttribute("data-page","100"));
But if I change 100 to a variable, like this ,it will report a error
var currentPageNo = "100" await page.$eval(' div.panel-footer > div > div > ul > li:nth-child(3) > a ',e => e.setAttribute("data-page",currentPageNo ));
node:4780) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: currentPageNo is not defined at __puppeteer_evaluation_script__:1:20 at ExecutionContext.evaluateHandle (\node_modules\puppeteer\lib\ExecutionContext.js:121:13) at process._tickCallback (internal/process/next_tick.js:68:7) -- ASYNC -- at ExecutionContext.<anonymous> (\node_modules\puppeteer\lib\helper.js:108:27) at ExecutionContext.evaluate (\node_modules\puppeteer\lib\ExecutionContext.js:48:31) at ExecutionContext.<anonymous> (\node_modules\puppeteer\lib\helper.js:109:23) at ElementHandle.$eval (\node_modules\puppeteer\lib\JSHandle.js:419:50) at process._tickCallback (internal/process/next_tick.js:68:7) -- ASYNC -- at ElementHandle.<anonymous> (\node_modules\puppeteer\lib\helper.js:108:27) at DOMWorld.$eval (\node_modules\puppeteer\lib\DOMWorld.js:149:21) -- ASYNC -- at Frame.<anonymous> (\node_modules\puppeteer\lib\helper.js:108:27) at Page.$eval (\node_modules\puppeteer\lib\Page.js:329:29) at Page.<anonymous> (\node_modules\puppeteer\lib\helper.js:109:23) at Object.switchToCurrentPageByClick (\functions\sh_common.js:43:23) (node:4780) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:4780) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The text was updated successfully, but these errors were encountered: