{"action":"opened","issue":{"url":"https://api.github.com/repos/GoogleChrome/puppeteer/issues/3499","repository_url":"https://api.github.com/repos/GoogleChrome/puppeteer","labels_url":"https://api.github.com/repos/GoogleChrome/puppeteer/issues/3499/labels{/name}","comments_url":"https://api.github.com/repos/GoogleChrome/puppeteer/issues/3499/comments","events_url":"https://api.github.com/repos/GoogleChrome/puppeteer/issues/3499/events","html_url":"https://github.com/GoogleChrome/puppeteer/issues/3499","id":377607554,"node_id":"MDU6SXNzdWUzNzc2MDc1NTQ=","number":3499,"title":"Evaluate seems not to have context to an object","user":{"login":"nei","id":33385,"node_id":"MDQ6VXNlcjMzMzg1","avatar_url":"https://avatars0.githubusercontent.com/u/33385?v=4","gravatar_id":"","url":"https://api.github.com/users/nei","html_url":"https://github.com/nei","followers_url":"https://api.github.com/users/nei/followers","following_url":"https://api.github.com/users/nei/following{/other_user}","gists_url":"https://api.github.com/users/nei/gists{/gist_id}","starred_url":"https://api.github.com/users/nei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nei/subscriptions","organizations_url":"https://api.github.com/users/nei/orgs","repos_url":"https://api.github.com/users/nei/repos","events_url":"https://api.github.com/users/nei/events{/privacy}","received_events_url":"https://api.github.com/users/nei/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-05T22:20:13Z","updated_at":"2018-11-05T22:20:13Z","closed_at":null,"author_association":"NONE","body":"I'm using the latest version 1.10.0 and I am trying to execute a function using evaluate and I am getting an error. Interesting that if I open the console and type the function it does work.\r\n\r\nIf I open the console and type the js code I want it does execute properly.\r\n```\r\n$obj.addWidget('history');\r\n```\r\n\r\nBut my evaluate code does not work. what I am missing here?\r\n\r\n```\r\nawait page.evaluate(() => {\r\n          $obj.addWidget('history');\r\n        });\r\n```\r\n**Tell us about your environment:**\r\n\r\n* Puppeteer version: 1.10.0\r\n* Platform / OS version: macOS 10.13.06\r\n* Node.js version: v10.8.0\r\n\r\nDetails of the error:\r\n```\r\n(node:89165) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: $obj is not defined\r\n    at __puppeteer_evaluation_script__:3:11\r\n    at ExecutionContext.evaluateHandle (/Users/nei/Projects/rico-puppeteer/node_modules/puppeteer/lib/ExecutionContext.js:124:13)\r\n    at process._tickCallback (internal/process/next_tick.js:68:7)\r\n  -- ASYNC --\r\n    at ExecutionContext.<anonymous> (/Users/nei/Projects/rico-puppeteer/node_modules/puppeteer/lib/helper.js:144:27)\r\n    at ExecutionContext.evaluate (/Users/nei/Projects/rico-puppeteer/node_modules/puppeteer/lib/ExecutionContext.js:58:31)\r\n    at ExecutionContext.<anonymous> (/Users/nei/Projects/rico-puppeteer/node_modules/puppeteer/lib/helper.js:145:23)\r\n    at Frame.evaluate (/Users/nei/Projects/rico-puppeteer/node_modules/puppeteer/lib/FrameManager.js:439:20)\r\n  -- ASYNC --\r\n    at Frame.<anonymous> (/Users/nei/Projects/rico-puppeteer/node_modules/puppeteer/lib/helper.js:144:27)\r\n    at Page.evaluate (/Users/nei/Projects/rico-puppeteer/node_modules/puppeteer/lib/Page.js:736:43)\r\n    at Page.<anonymous> (/Users/nei/Projects/rico-puppeteer/node_modules/puppeteer/lib/helper.js:145:23)\r\n```\r\n"}}
{"actor":{"display_login":"nei"}}