Nightwatch, Selenium and PhantomJS issue


#1

Following the tutorial over at MeteorCasts.net

I have everything set up and working up until adding in PhantomJS. So when I test the helloWorld.js file with just Selenium and it launches a browser window it works. However when I put in the “desired capabilities” portion into nightwatch.json file I get an error back like the following.

Error retrieving a new session from the selenium server
{ sessionId: null,
status: 13,
state: 'unhandled error',
value: 
{ cause: null,
hCode: 665814274,
screen: null,
message: null,
localizedMessage: null,
class: 'java.util.concurrent.TimeoutException' },
class: 'org.openqa.selenium.remote.Response',
hCode: 1950702248 }

I am pretty sure that it is actually making the connection to PhantomJS and the problem is there. Anyways any help would be appreciated. I am on a mac, using selenium 2.46.0 and phantomjs 2.0.0.


#2

Could you post your nightwatch.json file?


#3
    {
  "src_folders" : ["tests"],
  "output_folder" : "reports",
  "custom_commands_path" : "",
  "custom_assertions_path" : "",
  "page_objects_path" : "",
  "globals_path" : "",

  "selenium" : {
    "start_process" : true,
    "server_path" : "../../lib/selenium-server-standalone-2.46.0.jar",
    "log_path" : "",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "../../lib/chromedriver",
      "webdriver.ie.driver" : ""
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost:3000",
      "selenium_port"  : 4444,
      "selenium_host"  : "localhost",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "desiredCapabilities": {
        "browserName": "firefox",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    },

    "chrome" : {
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    },

    "phantomjs" : {
      "desiredCapabilities": {
        "browserName": "phantomjs",
        "javascriptEnabled": true,
        "acceptSslCerts": true,
        "phantomjs.binary.path": "../../lib/phantomjs"
      }
    }

  }
}

#4

Thanks for the help. I did get a response about this on the MeteorClub Slack group as well.

“phantom 2.0 doesn’t have webdriver bindings yet (ghost driver not in there yet last I looked), so you won’t be able to get a selenium based framework (like nightwatch) to work with it”


#5

Oh, I’m pretty sure folks have gotten Nightwatch and Phantom working together. I’m on the road right now, but check out this link:

Phantom config near bottom.