{"action":"created","issue":{"url":"https://api.github.com/repos/lapwinglabs/x-ray-phantom/issues/18","repository_url":"https://api.github.com/repos/lapwinglabs/x-ray-phantom","labels_url":"https://api.github.com/repos/lapwinglabs/x-ray-phantom/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/lapwinglabs/x-ray-phantom/issues/18/comments","events_url":"https://api.github.com/repos/lapwinglabs/x-ray-phantom/issues/18/events","html_url":"https://github.com/lapwinglabs/x-ray-phantom/issues/18","id":138767527,"number":18,"title":"Failing to pass options to nightmare","user":{"login":"ghostfreak3000","id":5859565,"avatar_url":"https://avatars.githubusercontent.com/u/5859565?v=3","gravatar_id":"","url":"https://api.github.com/users/ghostfreak3000","html_url":"https://github.com/ghostfreak3000","followers_url":"https://api.github.com/users/ghostfreak3000/followers","following_url":"https://api.github.com/users/ghostfreak3000/following{/other_user}","gists_url":"https://api.github.com/users/ghostfreak3000/gists{/gist_id}","starred_url":"https://api.github.com/users/ghostfreak3000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghostfreak3000/subscriptions","organizations_url":"https://api.github.com/users/ghostfreak3000/orgs","repos_url":"https://api.github.com/users/ghostfreak3000/repos","events_url":"https://api.github.com/users/ghostfreak3000/events{/privacy}","received_events_url":"https://api.github.com/users/ghostfreak3000/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-06T08:36:10Z","updated_at":"2016-03-16T16:16:09Z","closed_at":null,"body":"The Usage code snippet.\r\n\r\n```javascript\r\nvar phantom = require('x-ray-phantom');\r\nvar Xray = require('x-ray');\r\n\r\nvar x = Xray()\r\n  .driver(phantom());\r\n\r\nx('http://google.com', 'title')(function(err, str) {\r\n  if (err) return done(err);\r\n  assert.equal('Google', str);\r\n  done();\r\n})\r\n```\r\n\r\nproduces this error.\r\n![selection_003](https://cloud.githubusercontent.com/assets/5859565/13553139/30bbd090-e333-11e5-8fd5-f2ee95613efb.png)\r\n\r\nWhich is basically a XSS scripting security error. so naturally the solution is to disable web security in nightmare... with this code.\r\n\r\n```javascript\r\nvar phantom = require('x-ray-phantom');\r\nvar Xray = require('x-ray');\r\n\r\nvar phantom_opts = {\r\n  webPreferences:{\r\n    webSecurity:false\r\n  }\r\n}\r\n\r\nvar x = Xray()\r\n  .driver(phantom(phantom_opts));\r\n\r\nx('https://google.com', 'title')(function(err, str) {\r\n  if (err) return done(err);\r\n  assert.equal('Google', str);\r\n  done();\r\n})\r\n``` \r\nStill produces the same error.\r\nGot options structure from [here](https://github.com/atom/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions)\r\n\r\nPS:\r\nThe phantom process doesn't exit on this error.. not good. anyway we can set it to fail on error?"},"comment":{"url":"https://api.github.com/repos/lapwinglabs/x-ray-phantom/issues/comments/197405182","html_url":"https://github.com/lapwinglabs/x-ray-phantom/issues/18#issuecomment-197405182","issue_url":"https://api.github.com/repos/lapwinglabs/x-ray-phantom/issues/18","id":197405182,"user":{"login":"stephanechorne","id":1090696,"avatar_url":"https://avatars.githubusercontent.com/u/1090696?v=3","gravatar_id":"","url":"https://api.github.com/users/stephanechorne","html_url":"https://github.com/stephanechorne","followers_url":"https://api.github.com/users/stephanechorne/followers","following_url":"https://api.github.com/users/stephanechorne/following{/other_user}","gists_url":"https://api.github.com/users/stephanechorne/gists{/gist_id}","starred_url":"https://api.github.com/users/stephanechorne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephanechorne/subscriptions","organizations_url":"https://api.github.com/users/stephanechorne/orgs","repos_url":"https://api.github.com/users/stephanechorne/repos","events_url":"https://api.github.com/users/stephanechorne/events{/privacy}","received_events_url":"https://api.github.com/users/stephanechorne/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T16:16:09Z","updated_at":"2016-03-16T16:16:09Z","body":"Try with just `var phantom_opts = {webSecurity: false};`. Works for me."}}