Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 3
    This is not what I want to do, I want to be able to get to to variables passed as parameters to my function. Commented Mar 12, 2013 at 8:59
  • 7
    Did you even analyze and try my answer? I believe what you want to do is: page.evaluate(function(arg1, arg2){ console.log(arg1+arg2); }, arg1, arg2);. Commented Mar 12, 2013 at 9:33
  • 1
    Yes I want do that ! Thanks you very much ! :D Commented Mar 12, 2013 at 9:57
  • 11
    I was a bit thrown off too, before playing around with it. I believe this is more clear: page.evaluate(function(str, obj) { ... }, 'myString', {foo: 'bar'}); Commented Dec 30, 2014 at 2:09
  • 4
    I know this answer is from 2013, but it really should be edited so that the syntax that is explained in the comment is the syntax shown in the answer itself, so that visitors in 2017 (or later =) don't have to read through a comment thread to get the actual answer. Commented Aug 16, 2017 at 21:57