Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: undefined is not a function #1

Closed
TheFifthFreedom opened this issue Feb 18, 2015 · 11 comments
Closed

TypeError: undefined is not a function #1

TheFifthFreedom opened this issue Feb 18, 2015 · 11 comments

Comments

@TheFifthFreedom
Copy link

Quick question: I tried running node grid.js after having installed all the right dependencies for your NodeJS Selenium Grid implementation, and this is what I get:

/Users/lmazou/Downloads/selenium-grid-master/grid.js:21
app.configure(function(){
    ^
TypeError: undefined is not a function
    at Object.<anonymous> (/Users/lmazou/Downloads/selenium-grid-master/grid.js:21:5)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Any ideas?

@TheFifthFreedom
Copy link
Author

I spent a little bit of time digging around, and it looks like this issue (among others) is caused by the fact that this implementation hasn't been updated to work with Express 4, which is automatically installed when running npm install, since package.json suggests installing Express 3.0.6 or later. Which means there are a few things that needs to change:

First, config/setup.js has to go from this:

function setup(app, express) {

  app.configure('development', function() {
    require("./development.js")(app, express);
  });

  app.configure('staging', function() {
    require("./staging.js")(app, express);
  });

  app.configure('production', function() {
    require("./production.js")(app, express);
  });
}

module.exports = exports = setup;

to this:

function setup(app, express) {

  if ('development' == app.get('env')) {
    require("./development.js")(app, express);
  }

  if ('staging' == app.get('env')) {
    require("./staging.js")(app, express);
  }

  if ('production' == app.get('env')) {
    require("./production.js")(app, express);
  }
}

module.exports = exports = setup;

Second, grid.js (in the root folder) has to go from this:

var express = require('express')
  , routes = require('./routes')
  , http = require('http')
  , path = require('path')
  , createNodeProxy = require('./routes/nodeproxy')
  , setup = require('./config/setup.js')
  , less = require('less-middleware')
  , routes = require('./routes')
  , security = require('connect-security')
  ;

var InMemoryUserProvider = require('connect-security/lib/service/inmemoryuserprovider')
  , BasicAuthenticationFilter = require('connect-security/lib/filter/basicauthenticationfilter')
  , BasicAuthenticationEntryPoint = require('connect-security/lib/entrypoint/basicauthenticationentrypoint')
  ;

var app = express();

setup(app, express);

app.configure(function(){
  app.set('port', process.env.PORT || 3000);

  app.engine('ejs', require('ejs-locals'));
  app.set('views', __dirname + '/views');
  app.set('view engine', 'ejs');

  app.use(express.favicon());

  app.use(express.cookieParser());
  app.use(express.cookieSession({ key: 'testlabs-grid', secret: 'jdHU82*sH3!!laD' }));

  app.use(security({
    interceptUrls: [
      { url: /^\/(css|img|js)/, access: 'isAuthenticated()' },
      { url: /^\/admin/, access: 'hasRole("admin")' },
      { url: /^\/api/, access: 'isAuthenticated()' },
      { url: /^\//, access: 'hasRole("user")' }
    ],
    filters: [
      new BasicAuthenticationFilter({
        userProvider : new InMemoryUserProvider({
          users: app.get('users')
        })
      })
    ],
    entryPoint: new BasicAuthenticationEntryPoint({
      realmName: 'TestLabs Grid'
    })
  }))

  // all requests to /wd/hub/* should be proxied through to a node.
  app.use(createNodeProxy(app.get('host'), app.get('nodeStore'), app.get('sessionStore')));

  // set correct content-type on register requests
  app.use(function(req, res, next) {
    if (req.method == 'POST' && /\/grid\/register/.test(req.path)) {
      req.headers['content-type'] = 'application/json';
    }
    next();
  });

  app.use(express.bodyParser());
  app.use(app.router);
  app.use(less({ src: path.join(__dirname, 'public') }));
  app.use(express.static(path.join(__dirname, 'public')));
  app.use(security.errorHandler());
});

routes(app);

http.createServer(app).listen(app.get('port'), function(){
  console.log("TestLabs Grid listening on port " + app.get('port'));
});

To this:

var express = require('express')
  , routes = require('./routes')
  , http = require('http')
  , path = require('path')
  , createNodeProxy = require('./routes/nodeproxy')
  , setup = require('./config/setup.js')
  , less = require('less-middleware')
  , routes = require('./routes')
  , security = require('connect-security')
  ;

var InMemoryUserProvider = require('connect-security/lib/service/inmemoryuserprovider')
  , BasicAuthenticationFilter = require('connect-security/lib/filter/basicauthenticationfilter')
  , BasicAuthenticationEntryPoint = require('connect-security/lib/entrypoint/basicauthenticationentrypoint')
  ;

var app = express();

setup(app, express);

app.set('port', process.env.PORT || 3000);

app.engine('ejs', require('ejs-locals'));
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

app.use(express.favicon());

app.use(express.cookieParser());
app.use(express.cookieSession({ key: 'testlabs-grid', secret: 'jdHU82*sH3!!laD' }));

app.use(security({
  interceptUrls: [
    { url: /^\/(css|img|js)/, access: 'isAuthenticated()' },
    { url: /^\/admin/, access: 'hasRole("admin")' },
    { url: /^\/api/, access: 'isAuthenticated()' },
    { url: /^\//, access: 'hasRole("user")' }
  ],
  filters: [
    new BasicAuthenticationFilter({
      userProvider : new InMemoryUserProvider({
        users: app.get('users')
      })
    })
  ],
  entryPoint: new BasicAuthenticationEntryPoint({
    realmName: 'TestLabs Grid'
  })
}))

// all requests to /wd/hub/* should be proxied through to a node.
app.use(createNodeProxy(app.get('host'), app.get('nodeStore'), app.get('sessionStore')));

// set correct content-type on register requests
app.use(function(req, res, next) {
  if (req.method == 'POST' && /\/grid\/register/.test(req.path)) {
    req.headers['content-type'] = 'application/json';
  }
  next();
});

app.use(express.bodyParser());
app.use(app.router);
app.use(less({ src: path.join(__dirname, 'public') }));
app.use(express.static(path.join(__dirname, 'public')));
app.use(security.errorHandler());

routes(app);

http.createServer(app).listen(app.get('port'), function(){
  console.log("TestLabs Grid listening on port " + app.get('port'));
});

Then, there are a number of middleware that are no longer bundled with Express (which means they must be added to package.json and installed via npm) and whose name have changed:

  1. errorHandler -> errorhandler
    That means adding errorhandler = require('errorhandler') to config/development.js, and changing line 14 from app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); to app.use(errorhandler({ dumpExceptions: true, showStack: true }));
  2. favicon -> serve-favicon
    That means adding favicon = require('serve-favicon') to grid.js (root folder), and changing line 33 from app.use(express.favicon()); to app.use(favicon(__dirname + '/public/favicon.ico'));, but because there are no favicon.ico on file, might as well comment that entire line out.
  3. cookieParser -> cookie-parser
    That means adding cookieParser = require('cookie-parser') to grid.js (root folder), and changing line 31 from app.use(express.cookieParser()); to app.use(cookieParser());
  4. cookieSession -> cookie-session
    That means adding cookieSession = require('cookie-session') to grid.js (root folder), and changing line 33 from app.use(express.cookieSession({ key: 'testlabs-grid', secret: 'jdHU82*sH3!!laD' })); to app.use(cookieSession({ key: 'testlabs-grid', secret: 'jdHU82*sH3!!laD' }));
  5. bodyParser -> body-parser
    That means adding bodyParser = require('body-parser') to grid.js (root folder), and changing line 66 from app.use(express.bodyParser()); to app.use(bodyParser.json()); and perhaps adding app.use(bodyParser.urlencoded({ extended: false })) as well (not sure about that).
  6. app.router
    Because Express' middleware stack has been overhauled, line 69 of grid.js (root folder) is now obsolete. You can simply get rid of it.
  7. less
    Line 69 of grid.js (root folder) has to change from app.use(less({ src: path.join(__dirname, 'public') })); to app.use(less(path.join(__dirname, 'public')));

That should take care of that. Now node grid.js should run. However if you try to attach a node to it using the command java -jar selenium-server-standalone-<version>.jar -role node -hub http://<selenium-grid-server-ip>:3000/grid/register, the node cannot be registered for some reason. Here's my terminal output on the node side:

NYlmazon25152:Desktop lmazou$ java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:3000/grid/register
13:47:23.832 INFO - Launching a selenium grid node
13:47:25.820 WARN - error getting the parameters from the hub. The node may end up with wrong timeouts.Not a JSON Object: null
13:47:25.866 INFO - Java: Oracle Corporation 24.71-b01
13:47:25.866 INFO - OS: Mac OS X 10.10.2 x86_64
13:47:25.884 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
13:47:26.267 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: MAC
13:47:26.323 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:5555/wd/hub
13:47:26.324 INFO - Version Jetty/5.1.x
13:47:26.340 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
13:47:26.341 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:47:26.341 INFO - Started HttpContext[/,/]
13:47:26.402 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@60a556cf
13:47:26.402 INFO - Started HttpContext[/wd,/wd]
13:47:26.413 INFO - Started SocketListener on 0.0.0.0:5555
13:47:26.413 INFO - Started org.openqa.jetty.jetty.Server@12d1d6ce
13:47:26.548 INFO - using the json request : {"class":"org.openqa.grid.common.RegistrationRequest","configuration":{"register":true,"port":5555,"host":"10.211.100.178","proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","maxSession":5,"role":"node","hubHost":"localhost","registerCycle":5000,"hub":"http://localhost:3000/grid/register","hubPort":3000,"url":"http://10.211.100.178:5555","remoteHost":"http://10.211.100.178:5555"},"capabilities":[{"platform":"MAC","seleniumProtocol":"Selenium","browserName":"*firefox","maxInstances":5},{"platform":"MAC","seleniumProtocol":"Selenium","browserName":"*googlechrome","maxInstances":5},{"platform":"MAC","seleniumProtocol":"Selenium","browserName":"*iexplore","maxInstances":1},{"platform":"MAC","seleniumProtocol":"WebDriver","browserName":"firefox","maxInstances":5},{"platform":"MAC","seleniumProtocol":"WebDriver","browserName":"chrome","maxInstances":5},{"platform":"MAC","seleniumProtocol":"WebDriver","browserName":"internet explorer","maxInstances":1}]}
13:47:26.549 INFO - Starting auto register thread. Will try to register every 5000 ms.
13:47:26.549 INFO - Registering the node to hub :http://localhost:3000/grid/register
13:47:26.558 INFO - couldn't register this node : Error sending the registration request.
13:47:31.623 INFO - couldn't register this node : Hub is down or not responding: Hub is down or not responding.

and my terminal output on the server side:

NYlmazon25152:selenium-grid-master lmazou$ node grid.js
[2015-02-19 13:44:43.259] [DEBUG] inmemorynodestore.js - addNode: {"_json":{"configuration":{"remoteHost":"localhost:60001","timeout":180000},"capabilities":[]},"id":"localhost:60001","url":"localhost:60001","timeout":180000,"lastUpdated":"2015-02-19T18:44:43.258Z","lastSession":null,"_state":"node:available","error":null,"key":""}
TestLabs Grid listening on port 3000
[2015-02-19 13:44:53.261] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:44:53.266] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:03.266] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:03.266] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:13.271] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:13.271] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:23.275] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:23.275] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:33.280] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:33.280] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:43.286] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:43.286] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:53.288] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:53.288] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:03.290] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:03.290] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:13.295] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:13.295] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:23.298] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:23.298] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:33.302] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:33.303] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:43.303] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:43.303] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:53.308] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:53.308] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:47:03.312] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:47:03.312] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:47:13.314] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:47:13.315] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:47:23.316] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:47:23.316] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:47:25.776] [INFO] express.js - ::ffff:127.0.0.1 - - "GET /grid/api/hub HTTP/1.1" 401 - "" "Apache-HttpClient/4.3.4 (java 1.5)"
[2015-02-19 13:47:26.558] [INFO] express.js - ::ffff:127.0.0.1 - - "POST /grid/register HTTP/1.1" 401 - "" "Apache-HttpClient/4.3.4 (java 1.5)"
[2015-02-19 13:47:31.623] [INFO] express.js - ::ffff:127.0.0.1 - - "GET /grid/api/proxy?id=http://10.211.100.178:5555 HTTP/1.1" 401 - "" "Apache-HttpClient/4.3.4 (java 1.5)"
[2015-02-19 13:47:33.319] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:47:33.319] [DEBUG] inmemorysessionstore.js - _cleanSessions

Any ideas why that happens?

@stevewalton
Copy link

Hey Laurent,

Thanks for all of the information you've sent, we really appreciate it.
Sorry for our slow reply, things are busy over here!

We are no longer using Selenium Grid at all internally, so I guess that's
why we've fallen foul of the Express upgrade etc.

But since you're considering using it, I think we can find some time this
week to get things going again. We'll let you know when it's all good to
go.

In the meantime, completely shameless plug, check out the tool this version
of the grid was originally built to support: https://testlabs.io.

Thanks for your patience, we'll speak soon.

Steve

Steve Walton
Co-founder & Director
TestLabs.io
M: +44 (0) 7557 677511
E: steve@testlabs.io

On Thu, Feb 19, 2015 at 6:53 PM, Laurent Mazouer notifications@github.com
wrote:

I spent a little bit of time digging around, and it looks like this issue
(among others) is caused by the fact that this implementation hasn't been
updated to work with Express 4, which is automatically installed when
running npm install, since package.json suggests installing Express 3.0.6
or later. Which means there are a few things that needs to change:

First, config/setup.js has to go from this:

function setup(app, express) {

app.configure('development', function() {
require("./development.js")(app, express);
});

app.configure('staging', function() {
require("./staging.js")(app, express);
});

app.configure('production', function() {
require("./production.js")(app, express);
});
}
module.exports = exports = setup;

to this:

function setup(app, express) {

if ('development' == app.get('env')) {
require("./development.js")(app, express);
}

if ('staging' == app.get('env')) {
require("./staging.js")(app, express);
}

if ('production' == app.get('env')) {
require("./production.js")(app, express);
}
}
module.exports = exports = setup;

Second, grid.js (in the root folder) has to go from this:

var express = require('express')
, routes = require('./routes')
, http = require('http')
, path = require('path')
, createNodeProxy = require('./routes/nodeproxy')
, setup = require('./config/setup.js')
, less = require('less-middleware')
, routes = require('./routes')
, security = require('connect-security')
;
var InMemoryUserProvider = require('connect-security/lib/service/inmemoryuserprovider')
, BasicAuthenticationFilter = require('connect-security/lib/filter/basicauthenticationfilter')
, BasicAuthenticationEntryPoint = require('connect-security/lib/entrypoint/basicauthenticationentrypoint')
;
var app = express();

setup(app, express);

app.configure(function(){
app.set('port', process.env.PORT || 3000);

app.engine('ejs', require('ejs-locals'));
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

app.use(express.favicon());

app.use(express.cookieParser());
app.use(express.cookieSession({ key: 'testlabs-grid', secret: 'jdHU82*sH3!!laD' }));

app.use(security({
interceptUrls: [
{ url: /^/(css|img|js)/, access: 'isAuthenticated()' },
{ url: /^/admin/, access: 'hasRole("admin")' },
{ url: /^/api/, access: 'isAuthenticated()' },
{ url: /^//, access: 'hasRole("user")' }
],
filters: [
new BasicAuthenticationFilter({
userProvider : new InMemoryUserProvider({
users: app.get('users')
})
})
],
entryPoint: new BasicAuthenticationEntryPoint({
realmName: 'TestLabs Grid'
})
}))

// all requests to /wd/hub/* should be proxied through to a node.
app.use(createNodeProxy(app.get('host'), app.get('nodeStore'), app.get('sessionStore')));

// set correct content-type on register requests
app.use(function(req, res, next) {
if (req.method == 'POST' && //grid/register/.test(req.path)) {
req.headers['content-type'] = 'application/json';
}
next();
});

app.use(express.bodyParser());
app.use(app.router);
app.use(less({ src: path.join(__dirname, 'public') }));
app.use(express.static(path.join(__dirname, 'public')));
app.use(security.errorHandler());
});

routes(app);

http.createServer(app).listen(app.get('port'), function(){
console.log("TestLabs Grid listening on port " + app.get('port'));
});

To this:

var express = require('express')
, routes = require('./routes')
, http = require('http')
, path = require('path')
, createNodeProxy = require('./routes/nodeproxy')
, setup = require('./config/setup.js')
, less = require('less-middleware')
, routes = require('./routes')
, security = require('connect-security')
;
var InMemoryUserProvider = require('connect-security/lib/service/inmemoryuserprovider')
, BasicAuthenticationFilter = require('connect-security/lib/filter/basicauthenticationfilter')
, BasicAuthenticationEntryPoint = require('connect-security/lib/entrypoint/basicauthenticationentrypoint')
;
var app = express();

setup(app, express);

app.set('port', process.env.PORT || 3000);

app.engine('ejs', require('ejs-locals'));
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

app.use(express.favicon());

app.use(express.cookieParser());
app.use(express.cookieSession({ key: 'testlabs-grid', secret: 'jdHU82*sH3!!laD' }));

app.use(security({
interceptUrls: [
{ url: /^/(css|img|js)/, access: 'isAuthenticated()' },
{ url: /^/admin/, access: 'hasRole("admin")' },
{ url: /^/api/, access: 'isAuthenticated()' },
{ url: /^//, access: 'hasRole("user")' }
],
filters: [
new BasicAuthenticationFilter({
userProvider : new InMemoryUserProvider({
users: app.get('users')
})
})
],
entryPoint: new BasicAuthenticationEntryPoint({
realmName: 'TestLabs Grid'
})
}))
// all requests to /wd/hub/* should be proxied through to a node.
app.use(createNodeProxy(app.get('host'), app.get('nodeStore'), app.get('sessionStore')));
// set correct content-type on register requests
app.use(function(req, res, next) {
if (req.method == 'POST' && //grid/register/.test(req.path)) {
req.headers['content-type'] = 'application/json';
}
next();
});

app.use(express.bodyParser());
app.use(app.router);
app.use(less({ src: path.join(__dirname, 'public') }));
app.use(express.static(path.join(__dirname, 'public')));
app.use(security.errorHandler());

routes(app);

http.createServer(app).listen(app.get('port'), function(){
console.log("TestLabs Grid listening on port " + app.get('port'));
});

Then, there are a number of middleware that are no longer bundled with
Express (which means they must be added to package.json and installed via
npm) and whose name have changed:

errorHandler -> errorhandler
That means adding errorhandler = require('errorhandler') to
config/development.js, and changing line 14 from app.use(express.errorHandler({
dumpExceptions: true, showStack: true })); to app.use(errorhandler({
dumpExceptions: true, showStack: true }));
2.

favicon -> serve-favicon
That means adding favicon = require('serve-favicon') to grid.js (root
folder), and changing line 33 from app.use(express.favicon()); to app.use(favicon(__dirname

  • '/public/favicon.ico'));, but because there are no favicon.ico on
    file, might as well comment that entire line out.
    3.

    cookieParser -> cookie-parser
    That means adding cookieParser = require('cookie-parser') to grid.js
    (root folder), and changing line 31 from
    app.use(express.cookieParser()); to app.use(cookieParser());
    4.

    cookieSession -> cookie-session
    That means adding cookieSession = require('cookie-session') to grid.js
    (root folder), and changing line 33 from app.use(express.cookieSession({
    key: 'testlabs-grid', secret: 'jdHU82_sH3!!laD' })); to app.use(cookieSession({
    key: 'testlabs-grid', secret: 'jdHU82_sH3!!laD' }));
    5.

    bodyParser -> body-parser
    That means adding bodyParser = require('body-parser') to grid.js (root
    folder), and changing line 66 from app.use(express.bodyParser()); to
    app.use(bodyParser.json()); and perhaps adding app.use(bodyParser.urlencoded({
    extended: false })) as well (not sure about that).
    6.

    app.router
    Because Express' middleware stack has been overhauled, line 69 of
    grid.js (root folder) is now obsolete. You can simply get rid of it.
    7.

    less
    Line 69 of grid.js (root folder) has to change from app.use(less({
    src: path.join(__dirname, 'public') })); to app.use(less(path.join(__dirname,
    'public')));

That should take care of that. Now node grid.js should run. However if
you try to attach a node to it using the command java -jar
selenium-server-standalone-.jar -role node -hub http://
:3000/grid/register, the node cannot be
registered for some reason. Here's my terminal output on the node side:

NYlmazon25152:Desktop lmazou$ java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:3000/grid/register
13:47:23.832 INFO - Launching a selenium grid node
13:47:25.820 WARN - error getting the parameters from the hub. The node may end up with wrong timeouts.Not a JSON Object: null
13:47:25.866 INFO - Java: Oracle Corporation 24.71-b01
13:47:25.866 INFO - OS: Mac OS X 10.10.2 x86_64
13:47:25.884 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
13:47:26.267 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: MAC
13:47:26.323 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:5555/wd/hub
13:47:26.324 INFO - Version Jetty/5.1.x
13:47:26.340 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
13:47:26.341 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:47:26.341 INFO - Started HttpContext[/,/]
13:47:26.402 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@60a556cf
13:47:26.402 INFO - Started HttpContext[/wd,/wd]
13:47:26.413 INFO - Started SocketListener on 0.0.0.0:5555
13:47:26.413 INFO - Started org.openqa.jetty.jetty.Server@12d1d6ce
13:47:26.548 INFO - using the json request : {"class":"org.openqa.grid.common.RegistrationRequest","configuration":{"register":true,"port":5555,"host":"10.211.100.178","proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","maxSession":5,"role":"node","hubHost":"localhost","registerCycle":5000,"hub":"http://localhost:3000/grid/register","hubPort":3000,"url":"http://10.211.100.178:5555","remoteHost":"http://10.211.100.178:5555"},"capabilities":[{"platform":"MAC","seleniumProtocol":"Selenium","browserName":"*firefox","maxInstances":5},{"platform":"MAC","seleniumProtocol":"Selenium","browserName":"*googlechrome","maxInstances":5},{"platform":"MAC","seleniumProtocol":"Selenium","browserName":"*iexplore","maxInstances":1},{"platform":"MAC","seleniumProtocol":"WebDriver","browserName":"firefox","maxInstances":5},{"platform":"MAC","seleniumProtocol":"WebDriver","browserName":"chrome","maxInstances":5},{"platform":"MAC","seleniumProtocol":"WebDriver","browserName":"internet explorer","m
axInstances":1}]}
13:47:26.549 INFO - Starting auto register thread. Will try to register every 5000 ms.
13:47:26.549 INFO - Registering the node to hub :http://localhost:3000/grid/register
13:47:26.558 INFO - couldn't register this node : Error sending the registration request.
13:47:31.623 INFO - couldn't register this node : Hub is down or not responding: Hub is down or not responding.

and my terminal output on the server side:

NYlmazon25152:selenium-grid-master lmazou$ node grid.js
[2015-02-19 13:44:43.259] [DEBUG] inmemorynodestore.js - addNode: {"_json":{"configuration":{"remoteHost":"localhost:60001","timeout":180000},"capabilities":[]},"id":"localhost:60001","url":"localhost:60001","timeout":180000,"lastUpdated":"2015-02-19T18:44:43.258Z","lastSession":null,"_state":"node:available","error":null,"key":""}
TestLabs Grid listening on port 3000
[2015-02-19 13:44:53.261] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:44:53.266] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:03.266] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:03.266] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:13.271] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:13.271] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:23.275] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:23.275] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:33.280] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:33.280] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:43.286] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:43.286] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:45:53.288] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:45:53.288] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:03.290] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:03.290] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:13.295] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:13.295] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:23.298] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:23.298] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:33.302] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:33.303] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:43.303] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:43.303] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:46:53.308] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:46:53.308] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:47:03.312] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:47:03.312] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:47:13.314] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:47:13.315] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:47:23.316] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:47:23.316] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-19 13:47:25.776] [INFO] express.js - ::ffff:127.0.0.1 - - "GET /grid/api/hub HTTP/1.1" 401 - "" "Apache-HttpClient/4.3.4 (java 1.5)"
[2015-02-19 13:47:26.558] [INFO] express.js - ::ffff:127.0.0.1 - - "POST /grid/register HTTP/1.1" 401 - "" "Apache-HttpClient/4.3.4 (java 1.5)"
[2015-02-19 13:47:31.623] [INFO] express.js - ::ffff:127.0.0.1 - - "GET /grid/api/proxy?id=http://10.211.100.178:5555 HTTP/1.1" 401 - "" "Apache-HttpClient/4.3.4 (java 1.5)"
[2015-02-19 13:47:33.319] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-19 13:47:33.319] [DEBUG] inmemorysessionstore.js - _cleanSessions

Any ideas why that happens?


Reply to this email directly or view it on GitHub
#1 (comment)
.

CONFIDENTIAL NOTICE
This communication contains information which is confidential and may also
be privileged. It is for the exclusive use of the intended recipient(s). If
you are not the intended recipient please note that any distribution,
copying or use of this communication or the information in it is strictly
prohibited. If you received this communication in error, please notify us
by e-mail and then delete the e-mail and any copies of it.

Twenty Eight Automation Ltd is a company registered in England Wales No.
788788, at 13 Queens Crescent, Bedford, Bedfordshire, MK41 9BN.

@TheFifthFreedom
Copy link
Author

Dear Steve,

Thank you very much for getting back to me about this, and for taking time out of your busy schedule to fix it! Your help in getting this code going again will contribute a long way to what we're trying to accomplish: the only reason we're not using https://testlabs.io out-of-the-box is because our requirements are a little unusual, which is why your repo was the exact thing we needed. Rest assured that your team will get all of the credit they deserve once things get going on our side.
Now as I mentioned, what we're looking for is the ability to attach nodes to the Selenium Grid as you would expect with the regular Java implementation, including PhantomJS headless ones - you've mentioned issues with GhostDriver HTTP headers in the repo description, but I believe that issue was corrected by the PhantomJS team: https://github.com/detro/ghostdriver/issues/204
Anyhow, if you could help us with that, it would be absolutely fantastic. We very much look forward to hearing from you!

Cheers,

Laurent

@superafroman
Copy link
Member

Hey Laurent,

I've gone through and upgraded the dependencies etc.. Mostly like what you've given us but I've dropped a few things out that shouldn't be necessary.

The latest error you're seeing is because by default we have BASIC auth enabled (as in our use case the grid was public). I've turned this off by default now so a simple update should get you going.

Let me know how you go.

Max

@TheFifthFreedom
Copy link
Author

Dear Max,

Thanks for fixing this so quickly! I am now able to register both regular and PhantomJS instances as nodes to the Selenium Grid. However when I try to run a simple test scenario:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

driver = webdriver.Remote(
    command_executor='http://localhost:3000/wd/hub',
    desired_capabilities=DesiredCapabilities.CHROME)
driver.get('http://www.google.com')
html = driver.page_source
print (html)
driver.close()

which I got from http://selenium-python.readthedocs.org/en/latest/getting-started.html#using-selenium-with-remote-webdriver, this is what I get as error log from my Terminal:

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    desired_capabilities=DesiredCapabilities.CHROME)
  File "/Library/Python/2.7/site-packages/selenium-2.43.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 73, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/Library/Python/2.7/site-packages/selenium-2.43.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 121, in start_session
    'desiredCapabilities': desired_capabilities,
  File "/Library/Python/2.7/site-packages/selenium-2.43.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 173, in execute
    self.error_handler.check_response(response)
  File "/Library/Python/2.7/site-packages/selenium-2.43.0-py2.7.egg/selenium/webdriver/remote/errorhandler.py", line 136, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: 'Cannot POST /wd/hub/session\n'

Do you have a sense of what could be going wrong?

@superafroman
Copy link
Member

My first guess would be the node can't fine your Chrome driver - have you got the webdriver.chrome.driver system property set? If you've got Firefox installed you could try that as it doesn't need any extra config. Also PhantomJS should work out of the box if it's now connecting correctly.

You should get an error message in the grid logs - if none of the above helps can you post your logs?

@TheFifthFreedom
Copy link
Author

After some fiddling around, it turns out the issue was related to Python's errorhandling.py, and not to Selenium at all. Having fixed that, I'm happy to report that I was able to run the sample test scenario I mentioned in my previous message successfully using the regular Selenium java server in node mode with both Chrome and Firefox! I did notice something worth mentioning:

Laurents-iMac:selenium-grid-master Laurent$ node grid.js
Loading development environment
[2015-02-23 22:08:12.893] [DEBUG] inmemorynodestore.js - addNode: {"_json":{"configuration":{"remoteHost":"localhost:60001","timeout":180000},"capabilities":[]},"id":"localhost:60001","url":"localhost:60001","timeout":180000,"lastUpdated":"2015-02-24T03:08:12.893Z","lastSession":null,"_state":"node:available","error":null,"key":""}
TestLabs Grid listening at http://0.0.0.0:3000
[2015-02-23 22:08:22.897] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-23 22:08:22.897] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-23 22:08:32.902] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-23 22:08:32.902] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-23 22:08:35.664] [DEBUG] grid.js - retrieveHubStatus
[2015-02-23 22:08:35.668] [INFO] express.js - 127.0.0.1 - - "GET /grid/api/hub HTTP/1.1" 200 16 "" "Apache-HttpClient/4.3.4 (java 1.5)"
[2015-02-23 22:08:35.783] [DEBUG] grid.js - registerNode
[2015-02-23 22:08:35.783] [DEBUG] inmemorynodestore.js - addNode: {"_json":{"class":"org.openqa.grid.common.RegistrationRequest","configuration":{"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","role":"node","hub":"http://localhost:3000/grid/register","port":5555,"remoteHost":"http://192.168.0.20:5555","host":"192.168.0.20","maxSession":5,"hubHost":"localhost","registerCycle":5000,"hubPort":3000,"url":"http://192.168.0.20:5555","register":true},"capabilities":[{"seleniumProtocol":"Selenium","browserName":"*firefox","maxInstances":5,"platform":"MAC"},{"seleniumProtocol":"Selenium","browserName":"*googlechrome","maxInstances":5,"platform":"MAC"},{"seleniumProtocol":"Selenium","browserName":"*iexplore","maxInstances":1,"platform":"MAC"},{"seleniumProtocol":"WebDriver","browserName":"firefox","maxInstances":5,"platform":"MAC"},{"seleniumProtocol":"WebDriver","browserName":"chrome","maxInstances":5,"platform":"MAC"},{"seleniumProtocol":"WebDriver","browserName":"internet explorer","maxInstances":1,"platform":"MAC"}]},"id":"http://192.168.0.20:5555","url":"http://192.168.0.20:5555","lastUpdated":"2015-02-24T03:08:35.783Z","lastSession":null,"_state":"node:available","error":null,"key":""}
[2015-02-23 22:08:35.784] [INFO] express.js - 127.0.0.1 - - "POST /grid/register HTTP/1.1" 200 2 "" "Apache-HttpClient/4.3.4 (java 1.5)"
express deprecated req.param(name): Use req.params, req.body, or req.query instead routes/grid.js:31:18
[2015-02-23 22:08:40.789] [DEBUG] grid.js - retrieveNodeStatus, id = http://192.168.0.20:5555
[2015-02-23 22:08:40.789] [DEBUG] inmemorynodestore.js - findNodeById: http://192.168.0.20:5555
[2015-02-23 22:08:40.790] [INFO] express.js - 127.0.0.1 - - "GET /grid/api/proxy?id=http://192.168.0.20:5555 HTTP/1.1" 200 68 "" "Apache-HttpClient/4.3.4 (java 1.5)"
[2015-02-23 22:08:42.903] [DEBUG] inmemorynodestore.js - _cleanNodes
[2015-02-23 22:08:42.903] [DEBUG] inmemorysessionstore.js - _cleanSessions
[2015-02-23 22:08:45.797] [DEBUG] grid.js - retrieveNodeStatus, id = http://192.168.0.20:5555
[2015-02-23 22:08:45.797] [DEBUG] inmemorynodestore.js - findNodeById: http://192.168.0.20:5555
[2015-02-23 22:08:45.798] [INFO] express.js - 127.0.0.1 - - "GET /grid/api/proxy?id=http://192.168.0.20:5555 HTTP/1.1" 200 68 "" "Apache-HttpClient/4.3.4 (java 1.5)"

There is mention of req.param(name) as being deprecated (which is again related to Express 4) after a node registration. I believe the solution is to change line 31 of routes/grid.js from:

var id = req.param('id');

to:

var id = req.query.id;

and that should do the trick (please correct me if I'm wrong about this!)

Now while this works brilliantly when using Chrome or Firefox and the official Selenium Server java code, things get hairier with PhantomJS... I can register a PhantomJS node without issues, but when I try to run a sample test scenario like this one:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

driver = webdriver.Remote(
   command_executor='http://localhost:3000/wd/hub',
   desired_capabilities=DesiredCapabilities.PHANTOMJS)
driver.get("http://www.google.com")
html = driver.page_source
print (html)
driver.close()

This is what I get on the server window:

Laurents-iMac:selenium-grid-master Laurent$ node grid.js
Loading development environment
[2015-02-23 23:12:53.209] [DEBUG] inmemorynodestore.js - addNode: {"_json":{"configuration":{"remoteHost":"localhost:60001","timeout":180000},"capabilities":[]},"id":"localhost:60001","url":"localhost:60001","timeout":180000,"lastUpdated":"2015-02-24T04:12:53.209Z","lastSession":null,"_state":"node:available","error":null,"key":""}
TestLabs Grid listening at http://0.0.0.0:3000
[2015-02-23 23:12:54.780] [DEBUG] grid.js - registerNode
[2015-02-23 23:12:54.781] [DEBUG] inmemorynodestore.js - addNode: {"_json":{"capabilities":[{"browserName":"phantomjs","maxInstances":1,"seleniumProtocol":"WebDriver"}],"configuration":{"hub":"http://localhost:3000/","hubHost":"localhost","hubPort":3000,"port":8080,"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","maxSession":1,"register":true,"registerCycle":5000,"role":"wd","url":"http://127.0.0.1:8080","remoteHost":"http://127.0.0.1:8080"}},"id":"http://127.0.0.1:8080","url":"http://127.0.0.1:8080","lastUpdated":"2015-02-24T04:12:54.781Z","lastSession":null,"_state":"node:available","error":null,"key":""}
[2015-02-23 23:12:54.785] [INFO] express.js - 127.0.0.1 - - "POST /grid/register HTTP/1.1" 200 2 "" "Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"
[2015-02-23 23:12:57.713] [DEBUG] nodeproxy.js - handling request to /wd/hub/session, body = undefined
[2015-02-23 23:12:57.714] [DEBUG] nodeproxy.js - Handling new session
[2015-02-23 23:12:57.714] [DEBUG] inmemorynodestore.js - findNodeWithCapabilities: {"platform":"ANY","browserName":"phantomjs","version":"","javascriptEnabled":true}
[2015-02-23 23:12:57.714] [DEBUG] inmemorynodestore.js - Found node with capabilities.
[2015-02-23 23:12:57.714] [DEBUG] nodeproxy.js - Forwarding new session request to  http://127.0.0.1:8080
[2015-02-23 23:12:57.721] [ERROR] nodeproxy.js - Error starting session with node,  null
[2015-02-23 23:12:57.722] [DEBUG] inmemorynodestore.js - findNodeWithCapabilities: {"platform":"ANY","browserName":"phantomjs","version":"","javascriptEnabled":true}
[2015-02-23 23:12:57.722] [DEBUG] inmemorynodestore.js - Found with capabilites node but busy
express deprecated res.send(status, body): Use res.status(status).send(body) instead routes/nodeproxy.js:61:13
[2015-02-23 23:12:57.723] [INFO] express.js - undefined - - "POST /wd/hub/session HTTP/1.1" 503 82 "" "Python-urllib/3.4"

(you're looking for the line with the [ERROR] header)
this is what I get on the node window:

Laurents-iMac:Desktop Laurent$ phantomjs --webdriver=8080 --webdriver-selenium-grid-hub=http://localhost:3000
PhantomJS is launching GhostDriver...
[INFO  - 2015-02-24T04:12:54.757Z] GhostDriver - Main - running on port 8080
[INFO  - 2015-02-24T04:12:54.757Z] GhostDriver - Main - registering to Selenium HUB 'http://localhost:3000' using '127.0.0.1:8080'
[INFO  - 2015-02-24T04:12:54.787Z] HUB Register - register - Registered with grid hub: http://localhost:3000/ (ok)
[ERROR - 2015-02-24T04:12:57.720Z] RouterReqHand - _handle.error - {"message":"{\"headers\":{\"Accept\":\"application/json\",\"Connection\":\"keep-alive\",\"Content-Type\":\"application/json\",\"content-length\":\"114\",\"host\":\"127.0.0.1:8080\"},\"httpVersion\":\"1.1\",\"method\":\"POST\",\"url\":\"/session\",\"urlParsed\":{\"anchor\":\"\",\"query\":\"\",\"file\":\"session\",\"directory\":\"/\",\"path\":\"/session\",\"relative\":\"/session\",\"port\":\"\",\"host\":\"\",\"password\":\"\",\"user\":\"\",\"userInfo\":\"\",\"authority\":\"\",\"protocol\":\"\",\"source\":\"/session\",\"queryKey\":{},\"chunks\":[\"session\"]}}","name":"Missing Command Parameter","line":85,"sourceId":4504096256,"sourceURL":":/ghostdriver/request_handlers/session_manager_request_handler.js","stack":"Missing Command Parameter: {\"headers\":{\"Accept\":\"application/json\",\"Connection\":\"keep-alive\",\"Content-Type\":\"application/json\",\"content-length\":\"114\",\"host\":\"127.0.0.1:8080\"},\"httpVersion\":\"1.1\",\"method\":\"POST\",\"url\":\"/session\",\"urlParsed\":{\"anchor\":\"\",\"query\":\"\",\"file\":\"session\",\"directory\":\"/\",\"path\":\"/session\",\"relative\":\"/session\",\"port\":\"\",\"host\":\"\",\"password\":\"\",\"user\":\"\",\"userInfo\":\"\",\"authority\":\"\",\"protocol\":\"\",\"source\":\"/session\",\"queryKey\":{},\"chunks\":[\"session\"]}}\n    at :/ghostdriver/request_handlers/session_manager_request_handler.js:85\n    at :/ghostdriver/request_handlers/session_manager_request_handler.js:44\n    at :/ghostdriver/request_handlers/router_request_handler.js:70","stackArray":[{"sourceURL":":/ghostdriver/request_handlers/session_manager_request_handler.js","line":85},{"sourceURL":":/ghostdriver/request_handlers/session_manager_request_handler.js","line":44},{"sourceURL":":/ghostdriver/request_handlers/router_request_handler.js","line":70}]}

and this is what I get on the window where I'm running the test scenario:

Laurents-iMac:Desktop Laurent$ python3 test.py
Traceback (most recent call last):
  File "test.py", line 7, in <module>
    desired_capabilities=DesiredCapabilities.PHANTOMJS)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 73, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 121, in start_session
    'desiredCapabilities': desired_capabilities,
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 173, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/selenium/webdriver/remote/errorhandler.py", line 136, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: Error forwarding new session request, no nodes available for desired capabilities.

Would you happen to know what's going on?

@TheFifthFreedom
Copy link
Author

A little more housekeeping - I found a few deprecated function calls in routes/nodeproxy.js:

line 34

res.send(500, error);

which should be

res.status(500).send(error)

line 61

res.send(503,
          'Error forwarding new session request, no nodes available for desired capabilities.');

which should be

res.status(503).send('Error forwarding new session request, no nodes available for desired capabilities.')

line 84

res.send(302);

which should be

res.status(302)

I haven't figured out the PhantomJS problem I exposed in my previous message however - did you have better luck @superafroman ? I can't seem to be able to run any sort of test scenario on a PhantomJS node, even thought attaching one to the Grid works...

@superafroman
Copy link
Member

I believe the issue with case sensitive HTTP headers has only been fixed in PhantomJS 2.0 - which isn't supported by GhostDriver yet. Until that's updated you won't be able to use PhantomJS with this grid.

@TheFifthFreedom
Copy link
Author

After a bit of digging, I think you're right: from what I understand, there has been a fix upstream for this issue for over a year but nobody seems to care about PhantomJS enough to backport it and release a new version that includes the fix. In the meantime, we might experiment a headless Chromium + xvfb configuration instead.
Thank you again for your time @superafroman - you've been tremendous. We're gonna fork your great work and take it from here. Would you mind if we came back here to ask you a few questions in the future should we have any?

@superafroman
Copy link
Member

Not at all - absolutely happy to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants