{"action":"created","issue":{"url":"https://api.github.com/repos/peteward44/gulp-nightwatch-headless/issues/2","labels_url":"https://api.github.com/repos/peteward44/gulp-nightwatch-headless/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/peteward44/gulp-nightwatch-headless/issues/2/comments","events_url":"https://api.github.com/repos/peteward44/gulp-nightwatch-headless/issues/2/events","html_url":"https://github.com/peteward44/gulp-nightwatch-headless/issues/2","id":94099329,"number":2,"title":"Error retrieving a new session from the selenium server","user":{"login":"GrayedFox","id":6493307,"avatar_url":"https://avatars.githubusercontent.com/u/6493307?v=3","gravatar_id":"","url":"https://api.github.com/users/GrayedFox","html_url":"https://github.com/GrayedFox","followers_url":"https://api.github.com/users/GrayedFox/followers","following_url":"https://api.github.com/users/GrayedFox/following{/other_user}","gists_url":"https://api.github.com/users/GrayedFox/gists{/gist_id}","starred_url":"https://api.github.com/users/GrayedFox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrayedFox/subscriptions","organizations_url":"https://api.github.com/users/GrayedFox/orgs","repos_url":"https://api.github.com/users/GrayedFox/repos","events_url":"https://api.github.com/users/GrayedFox/events{/privacy}","received_events_url":"https://api.github.com/users/GrayedFox/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-09T16:49:30Z","updated_at":"2015-07-09T20:55:18Z","closed_at":null,"body":"Hey there,\r\n\r\nI've searched and all over the web however I cannot find a solution to the problems I am experiencing. I am not so sure it's a bug with gulp-nightwatch-headless as opposed to a configuration error on my part - but if it turns out to be a config error it sure would be useful to figure out where.\r\n\r\nIn my gulpfile I have this task:\r\n\r\n```\r\ngulp.task('phantom', function phantomTest() {\r\n  return gulp.src('')\r\n    .pipe(nightwatchHeadless({\r\n      nightwatch: {\r\n        tempDir: 'temp',\r\n        config: 'nightwatch.json',\r\n        env: 'phantom'\r\n      },\r\n      selenium: {\r\n        disable: false\r\n      },\r\n      verbose: true\r\n    }))\r\n  .on('error', gutil.log);\r\n});\r\n```\r\n\r\nThe important part of my nightwatch.json file looks like this:\r\n\r\n```\r\n  \"selenium\": {\r\n    \"start_process\": false,\r\n    \"server_path\": \"node_modules/gulp-nightwatch-headless/node_modules/selenium-server/lib/runner/selenium-server-standalone-2.46.0.jar\",\r\n    \"log_path\": \"reports\",\r\n    \"host\": \"127.0.0.1\",\r\n    \"cli_args\": {\r\n      \"webdriver.chrome.driver\": \"\",\r\n      \"webdriver.ie.driver\": \"\"\r\n    }\r\n  },\r\n    \"phantom\": {\r\n      \"desiredCapabilities\": {\r\n        \"browserName\": \"phantomjs\",\r\n        \"javascriptEnabled\": true,\r\n        \"acceptSslCerts\": true,\r\n        \"phantomjs.binary.path\": \"node_modules/gulp-nightwatch-headless/node_modules/phantomjs/bin/phantomjs\",\r\n        \"phantom.cli.args\": \"--webdriver=4444 --webdriver-selenium-grid-hub=http://localhost:4444\"\r\n      }\r\n```\r\n\r\nNow, the exact error with the above config after running ```gulp \"phantom\"``` from the terminal is:\r\n\r\n```\r\nError retrieving a new session from the selenium server\r\n{ status: 13,\r\n  value: \r\n   { class: 'org.openqa.grid.common.exception.GridException',\r\n     message: 'Error forwarding the new session cannot find : Capabilities [{platform=ANY, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, name=KFTC}]' } }\r\n\r\nConnection refused! Is selenium server started?\r\n```\r\n\r\nWhich is strange and quite possibly this https://github.com/nightwatchjs/nightwatch/issues/309 issue. \r\n\r\nNow, if I change ```selenium { disable: false }``` to TRUE (in the gulpfile) and change NOTHING else, I get this in the console, which is weird because I don't start a selenium server at all (manually, via nightwatch or via gulp):\r\n\r\n```\r\nUnsafe JavaScript attempt to access frame with URL about:blank from frame with URL file://main.js. Domains, protocols and ports must match.\r\n```\r\n\r\nWhich is misleading... I think this comes from Phantom but I'm not sure. It gets a few hits in Google but I think this is a red herring.\r\n\r\nFinally, if I change the selenium part in nightwatch.json to ```\"start_process\": true``` and the gulpfile part to false (i.e. enabled) I get the expected output, namely, that a selenium server is already running. My guess is the gulp-nightwatch-headless attempts to start a selenium server on top of the already running one which nightwatch started, so this error makes sense: ```Selenium is already running on port X``` \r\n\r\nHere's the rub: running my tests via Nightwatch only (without gulp-nightwatch-headless) works just fine. I can run them via PhPstorm and the debugger, or simply by starting the test via the CLI, and can test on Firefox AND headlessly on phantomjs.\r\n\r\nThis is what makes me believe it is actually gulp-nightwatch-headless that is the root of the issue. Running the tests manually perform well - and just to make sure, I configured my nightwatch.json to point to the packages bundled with gulp-nightwatch-headless.\r\n\r\nSorry for the long post. Wanted to include everything just in case."},"comment":{"url":"https://api.github.com/repos/peteward44/gulp-nightwatch-headless/issues/comments/120141606","html_url":"https://github.com/peteward44/gulp-nightwatch-headless/issues/2#issuecomment-120141606","issue_url":"https://api.github.com/repos/peteward44/gulp-nightwatch-headless/issues/2","id":120141606,"user":{"login":"peteward44","id":6538543,"avatar_url":"https://avatars.githubusercontent.com/u/6538543?v=3","gravatar_id":"","url":"https://api.github.com/users/peteward44","html_url":"https://github.com/peteward44","followers_url":"https://api.github.com/users/peteward44/followers","following_url":"https://api.github.com/users/peteward44/following{/other_user}","gists_url":"https://api.github.com/users/peteward44/gists{/gist_id}","starred_url":"https://api.github.com/users/peteward44/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peteward44/subscriptions","organizations_url":"https://api.github.com/users/peteward44/orgs","repos_url":"https://api.github.com/users/peteward44/repos","events_url":"https://api.github.com/users/peteward44/events{/privacy}","received_events_url":"https://api.github.com/users/peteward44/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T20:55:18Z","updated_at":"2015-07-09T20:55:18Z","body":"Hi! I've tried to replicate this but haven't had any luck. Do you mind creating a simple project that causes the same issue for you?\r\n\r\nBy the way, you don't need to manually specify the \"phantomjs.binary.path\" and \"server_path\" arguments in your config - gulp-nightwatch-headless does this for you.\r\n\r\nThanks!"}}