{"action":"created","issue":{"url":"https://api.github.com/repos/beatfactor/nightwatch/issues/235","labels_url":"https://api.github.com/repos/beatfactor/nightwatch/issues/235/labels{/name}","comments_url":"https://api.github.com/repos/beatfactor/nightwatch/issues/235/comments","events_url":"https://api.github.com/repos/beatfactor/nightwatch/issues/235/events","html_url":"https://github.com/beatfactor/nightwatch/issues/235","id":40450687,"number":235,"title":"Take a screenshot when a test fails","user":{"login":"ojame","id":2898239,"avatar_url":"https://avatars.githubusercontent.com/u/2898239?v=3","gravatar_id":"","url":"https://api.github.com/users/ojame","html_url":"https://github.com/ojame","followers_url":"https://api.github.com/users/ojame/followers","following_url":"https://api.github.com/users/ojame/following{/other_user}","gists_url":"https://api.github.com/users/ojame/gists{/gist_id}","starred_url":"https://api.github.com/users/ojame/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ojame/subscriptions","organizations_url":"https://api.github.com/users/ojame/orgs","repos_url":"https://api.github.com/users/ojame/repos","events_url":"https://api.github.com/users/ojame/events{/privacy}","received_events_url":"https://api.github.com/users/ojame/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-08-18T02:29:13Z","updated_at":"2015-02-04T18:46:34Z","closed_at":null,"body":"I'm aware of the screenshot option when selenium errors, but I'm trying to take a screenshot when a test fails.\r\n\r\nThere's no method (as far as I can tell) to fire a function when the test fails. There is no way to pass `browser` to `tearDown` ([source](https://groups.google.com/forum/#!msg/nightwatchjs/Of66pHN9zWQ/MVYwk4Q4mosJ)).\r\n\r\nThe test doesn't `throw` on error, so there's no way I can use a `try catch` as far as I can tell.\r\n\r\nDoes anyone have any suggestions?"},"comment":{"url":"https://api.github.com/repos/beatfactor/nightwatch/issues/comments/72913406","html_url":"https://github.com/beatfactor/nightwatch/issues/235#issuecomment-72913406","issue_url":"https://api.github.com/repos/beatfactor/nightwatch/issues/235","id":72913406,"user":{"login":"billyvg","id":79684,"avatar_url":"https://avatars.githubusercontent.com/u/79684?v=3","gravatar_id":"","url":"https://api.github.com/users/billyvg","html_url":"https://github.com/billyvg","followers_url":"https://api.github.com/users/billyvg/followers","following_url":"https://api.github.com/users/billyvg/following{/other_user}","gists_url":"https://api.github.com/users/billyvg/gists{/gist_id}","starred_url":"https://api.github.com/users/billyvg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billyvg/subscriptions","organizations_url":"https://api.github.com/users/billyvg/orgs","repos_url":"https://api.github.com/users/billyvg/repos","events_url":"https://api.github.com/users/billyvg/events{/privacy}","received_events_url":"https://api.github.com/users/billyvg/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T18:46:34Z","updated_at":"2015-02-04T18:46:34Z","body":"The screenshot option kind of works for me, but when using PhantomJS (and possibly with other browsers), it will take a screenshot of my entire desktop and not a screenshot within the browser.\r\n\r\nUsing saveScreenshot inside of my tests however will take the proper screenshot."}}