-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Closed
Description
Steps to reproduce
Tell us about your environment:
- Puppeteer version: ^0.10.2
- Platform / OS version: Ubuntu 16.04.2 LTS
What steps will reproduce the problem?
Problem 1: arguments passed to waitFor is undefined:
- Pass any argument to waitFor or waitForFunction.
- Get/Call that argument inside the function.
- It's
undefined.
Problem 2: arguments property inside page.evaluate is undefined.
- Call
argumentsinside any page.evaluate function. - It's undefined and results in TypeError.
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('https://example.com');
await page.waitForFunction((args) => {
// some tests to show what is happeneing.
console.log([
args, // should show args
arguments, // should not have 0 elements
Array.isArray(args), // should return True
Array.isArray([1, 2, 3, 4]) // should return True
]);
return Array.isArray(args);
}, [1, 2, 3, 4]); // no matter what you pass, it's still undefined;
await page.screenshot({path: 'example.png'});
//browser.close();
})();Meanwhile, the evaluate method shows arguments as undefined while the args provided is working properly.
await page.evaluate((args) => {
// shows `ReferenceError: arguments is not defined`
console.log(arguments)
// runs properly
console.log([
args,
Array.isArray(args),
Array.isArray([1, 2, 3, 4])
]);
return Array.isArray(args);
}, [1, 2, 3, 4]);What is the expected result?
It should behave like page evaluate and the arguments should be passed properly.
What happens instead?
Arguments are not passed.
Waits are timed out.
Metadata
Metadata
Assignees
Labels
No labels