Skip to content
Advertisement

Puppeteer to invoke javascript function from an external .js file

Any one has a idea on how to invoke a javascript function from puppeteer which is not inline but in an external .js file. If its inline within the html->head->script tag it works but not if the script tag points to an external .js file Sample HTML File Sample Javascript file Puppeteer code sample Answer First of all, [name=”link”] should

Alternative syntax to access javascript function arguments

prints Is there a way to access the actual arguments in that case? Answer I would advise against overriding the built-in arguments variable within a function definition. You could spread the expected arguments instead using …vargs. Please take a look at the arguments object over at MDN for more info. The documentation notes that if you are using ES6 syntax,

Advertisement