Open TheFifthFreedom opened 9 years ago
@TheFifthFreedom Thanks for the report!
Yes, the problem is with gaze
and node-gyp
. I've also hit it.
First of all, I'm glad to see someone finally open-sourcing a serious and well-maintained re-implementation of the Selenium Grid using NodeJS
It is still a work in progress. I will be glad if someone could join the forces to make it a really good reimplementation.
For now I'm in a stage of reimplementing registry and store so it:
etcd
, consul
) to get it run as a multiple process and on many machinesWell I'd be glad to help in any way I can - it will just take me a bit of time to get acclimated with your implementation first. One other thing I've noticed is that once I've installed the necessary dependencies via npm install
after downgrading NodeJS version, I run ./bin/selenodium-grid
as you described in your readme
, but as soon as I try to attach a node using the Selenium Standalone Server using java -jar selenium-server-standalone-2.45.0.jar -role node -hub http://127.0.0.1:4444/grid/register
, the node can't connect to the hub somehow:
Hub log
17:02:02.92 log.js:45 [info]: Hub is listening on http://localhost:4444
17:02:54.62 log.js:45 [info]: ::ffff:127.0.0.1:59114 --> GET /grid/api/hub HTTP/1.1
17:02:54.68 log.js:45 [info]: ::ffff:127.0.0.1:59114 <== 200 GET /grid/api/hub HTTP/1.1 -
17:02:54.91 log.js:45 [info]: ::ffff:127.0.0.1:59114 --> POST /grid/register HTTP/1.1
17:02:54.92 log.js:45 [info]: ::ffff:127.0.0.1:59114 <== 400 POST /grid/register HTTP/1.1 -
17:02:59.99 log.js:45 [info]: ::ffff:127.0.0.1:59115 --> GET /grid/api/proxy?id=http://10.211.100.178:5555 HTTP/1.1
17:02:59.100 log.js:45 [info]: ::ffff:127.0.0.1:59115 <== 404 GET /grid/api/proxy?id=http://10.211.100.178:5555 HTTP/1.1 -
17:03:05.08 log.js:45 [info]: ::ffff:127.0.0.1:59117 --> GET /grid/api/proxy?id=http://10.211.100.178:5555 HTTP/1.1
17:03:05.15 log.js:45 [info]: ::ffff:127.0.0.1:59117 <== 404 GET /grid/api/proxy?id=http://10.211.100.178:5555 HTTP/1.1 -
^C17:03:08.71 log.js:45 [info]: Stopping grid
Node log
17:02:52.442 INFO - Launching a selenium grid node
17:02:54.141 INFO - Java: Oracle Corporation 24.71-b01
17:02:54.141 INFO - OS: Mac OS X 10.10.2 x86_64
17:02:54.163 INFO - v2.45.0, with Core v2.45.0. Built from revision 5017cb8
17:02:54.451 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
17:02:54.530 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:5555/wd/hub
17:02:54.531 INFO - Version Jetty/5.1.x
17:02:54.542 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
17:02:54.543 INFO - Started HttpContext[/selenium-server,/selenium-server]
17:02:54.543 INFO - Started HttpContext[/,/]
17:02:54.768 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@5e3c782
17:02:54.768 INFO - Started HttpContext[/wd,/wd]
17:02:54.780 INFO - Started SocketListener on 0.0.0.0:5555
17:02:54.780 INFO - Started org.openqa.jetty.jetty.Server@658762b1
17:02:54.893 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":"127.0.0.1","registerCycle":5000,"hub":"http://127.0.0.1:4444/grid/register","hubPort":4444,"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}]}
17:02:54.894 INFO - Starting auto register thread. Will try to register every 5000 ms.
17:02:54.894 INFO - Registering the node to hub :http://127.0.0.1:4444/grid/register
17:02:54.917 INFO - couldn't register this node : Error sending the registration request.
17:03:00.000 INFO - couldn't register this node : Hub is down or not responding: Hub is down or not responding.
17:03:05.018 INFO - couldn't register this node : Hub is down or not responding: Hub is down or not responding.
^C17:03:06.268 INFO - Shutting down...
Would you happen to know what's going on? (I'm running the dev branch code)
It looks like the issue happens when the Selenium node is sending a POST request which is routed to /grid/register
- as per register.js
:
module.exports = function(req, res) {
if (!req.data) {
return q.reject(apps.content('Invalid parameters', 'text/plain', 400));
}
return q.invoke(registry, 'addNode', req.data)
.catch(function() {
return q.reject(apps.content('Invalid parameters', 'text/plain', 400));
})
.then(function(success) {
if (success) {
log.info('Register new node: %s', JSON.stringify(req.data));
return apps.content('ok');
}
return q.reject(apps.content('Invalid parameters', 'text/plain', 400));
});
};
the code is trying to access req.data
which doesn't exist. I did try to print the JSON request the server receives from the Selenium node:
{ version: [ 1, 1 ],
method: 'POST',
path: '/grid/register',
_pathInfo: null,
scriptName: '',
scheme: 'http',
hostname: 'localhost',
port: 4444,
host: 'localhost:4444',
remoteHost: '::ffff:127.0.0.1',
remotePort: 55047,
url: 'http://localhost:4444/grid/register',
body:
{ read: [Function],
forEach: [Function],
close: [Function],
node:
{ _readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_maxListeners: 10,
socket: [Object],
connection: [Object],
httpVersion: '1.1',
complete: true,
headers: [Object],
trailers: {},
_pendings: [],
_pendingIndex: 0,
url: '/grid/register',
method: 'POST',
statusCode: null,
client: [Object],
_consuming: true,
_dumped: false,
httpVersionMajor: 1,
httpVersionMinor: 1,
upgrade: false,
pipe: [Function],
addListener: [Function],
on: [Function],
pause: [Function],
resume: [Function],
read: [Function] } },
headers:
{ 'content-length': '970',
'content-type': 'text/plain; charset=UTF-8',
host: 'localhost:4444',
connection: 'Keep-Alive',
'user-agent': 'Apache-HttpClient/4.3.6 (java 1.5)',
'accept-encoding': 'gzip,deflate' },
node:
{ _readableState:
{ highWaterMark: 16384,
buffer: [],
length: 0,
pipes: null,
pipesCount: 0,
flowing: false,
ended: true,
endEmitted: false,
reading: false,
calledRead: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
objectMode: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: true,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ error: [Object],
end: [Object],
data: [Function],
readable: [Function],
close: [Function] },
_maxListeners: 10,
socket:
{ _connecting: false,
_handle: [Object],
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_maxListeners: 10,
_writableState: [Object],
writable: true,
allowHalfOpen: true,
onend: [Function],
destroyed: false,
errorEmitted: false,
bytesRead: 1430,
_bytesDispatched: 440,
_pendingData: null,
_pendingEncoding: '',
server: [Object],
_idleTimeout: 60000,
_idleNext: [Object],
_idlePrev: [Object],
_idleStart: 1426795070410,
parser: [Object],
ondata: [Function],
_peername: [Object],
_httpMessage: [Object] },
connection:
{ _connecting: false,
_handle: [Object],
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_maxListeners: 10,
_writableState: [Object],
writable: true,
allowHalfOpen: true,
onend: [Function],
destroyed: false,
errorEmitted: false,
bytesRead: 1430,
_bytesDispatched: 440,
_pendingData: null,
_pendingEncoding: '',
server: [Object],
_idleTimeout: 60000,
_idleNext: [Object],
_idlePrev: [Object],
_idleStart: 1426795070410,
parser: [Object],
ondata: [Function],
_peername: [Object],
_httpMessage: [Object] },
httpVersion: '1.1',
complete: true,
headers:
{ 'content-length': '970',
'content-type': 'text/plain; charset=UTF-8',
host: 'localhost:4444',
connection: 'Keep-Alive',
'user-agent': 'Apache-HttpClient/4.3.6 (java 1.5)',
'accept-encoding': 'gzip,deflate' },
trailers: {},
_pendings: [],
_pendingIndex: 0,
url: '/grid/register',
method: 'POST',
statusCode: null,
client:
{ _connecting: false,
_handle: [Object],
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_maxListeners: 10,
_writableState: [Object],
writable: true,
allowHalfOpen: true,
onend: [Function],
destroyed: false,
errorEmitted: false,
bytesRead: 1430,
_bytesDispatched: 440,
_pendingData: null,
_pendingEncoding: '',
server: [Object],
_idleTimeout: 60000,
_idleNext: [Object],
_idlePrev: [Object],
_idleStart: 1426795070410,
parser: [Object],
ondata: [Function],
_peername: [Object],
_httpMessage: [Object] },
_consuming: true,
_dumped: false,
httpVersionMajor: 1,
httpVersionMinor: 1,
upgrade: false,
pipe: [Function],
addListener: [Function],
on: [Function],
pause: [Function],
resume: [Function],
read: [Function] },
nodeRequest:
{ _readableState:
{ highWaterMark: 16384,
buffer: [],
length: 0,
pipes: null,
pipesCount: 0,
flowing: false,
ended: true,
endEmitted: false,
reading: false,
calledRead: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
objectMode: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: true,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ error: [Object],
end: [Object],
data: [Function],
readable: [Function],
close: [Function] },
_maxListeners: 10,
socket:
{ _connecting: false,
_handle: [Object],
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_maxListeners: 10,
_writableState: [Object],
writable: true,
allowHalfOpen: true,
onend: [Function],
destroyed: false,
errorEmitted: false,
bytesRead: 1430,
_bytesDispatched: 440,
_pendingData: null,
_pendingEncoding: '',
server: [Object],
_idleTimeout: 60000,
_idleNext: [Object],
_idlePrev: [Object],
_idleStart: 1426795070410,
parser: [Object],
ondata: [Function],
_peername: [Object],
_httpMessage: [Object] },
connection:
{ _connecting: false,
_handle: [Object],
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_maxListeners: 10,
_writableState: [Object],
writable: true,
allowHalfOpen: true,
onend: [Function],
destroyed: false,
errorEmitted: false,
bytesRead: 1430,
_bytesDispatched: 440,
_pendingData: null,
_pendingEncoding: '',
server: [Object],
_idleTimeout: 60000,
_idleNext: [Object],
_idlePrev: [Object],
_idleStart: 1426795070410,
parser: [Object],
ondata: [Function],
_peername: [Object],
_httpMessage: [Object] },
httpVersion: '1.1',
complete: true,
headers:
{ 'content-length': '970',
'content-type': 'text/plain; charset=UTF-8',
host: 'localhost:4444',
connection: 'Keep-Alive',
'user-agent': 'Apache-HttpClient/4.3.6 (java 1.5)',
'accept-encoding': 'gzip,deflate' },
trailers: {},
_pendings: [],
_pendingIndex: 0,
url: '/grid/register',
method: 'POST',
statusCode: null,
client:
{ _connecting: false,
_handle: [Object],
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_maxListeners: 10,
_writableState: [Object],
writable: true,
allowHalfOpen: true,
onend: [Function],
destroyed: false,
errorEmitted: false,
bytesRead: 1430,
_bytesDispatched: 440,
_pendingData: null,
_pendingEncoding: '',
server: [Object],
_idleTimeout: 60000,
_idleNext: [Object],
_idlePrev: [Object],
_idleStart: 1426795070410,
parser: [Object],
ondata: [Function],
_peername: [Object],
_httpMessage: [Object] },
_consuming: true,
_dumped: false,
httpVersionMajor: 1,
httpVersionMinor: 1,
upgrade: false,
pipe: [Function],
addListener: [Function],
on: [Function],
pause: [Function],
resume: [Function],
read: [Function] },
nodeConnection:
{ _connecting: false,
_handle:
{ fd: 14,
writeQueueSize: 0,
owner: [Circular],
onread: [Function: onread],
reading: true },
_readableState:
{ highWaterMark: 16384,
buffer: [],
length: 0,
pipes: null,
pipesCount: 0,
flowing: false,
ended: false,
endEmitted: false,
reading: true,
calledRead: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
objectMode: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ end: [Object],
finish: [Function: onSocketFinish],
_socketEnd: [Function: onSocketEnd],
drain: [Function: ondrain],
timeout: [Object],
error: [Function],
close: [Object] },
_maxListeners: 10,
_writableState:
{ highWaterMark: 16384,
objectMode: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
buffer: [] },
writable: true,
allowHalfOpen: true,
onend: [Function],
destroyed: false,
errorEmitted: false,
bytesRead: 1430,
_bytesDispatched: 440,
_pendingData: null,
_pendingEncoding: '',
server:
{ domain: null,
_events: [Object],
_maxListeners: 10,
_connections: 1,
connections: [Getter/Setter],
_handle: [Object],
_usingSlaves: false,
_slaves: [],
allowHalfOpen: true,
httpAllowHalfOpen: true,
timeout: 120000,
destroy: [Function],
_connectionKey: '6::::4444' },
_idleTimeout: 60000,
_idleNext: { _idleNext: [Circular], _idlePrev: [Circular] },
_idlePrev: { _idleNext: [Circular], _idlePrev: [Circular] },
_idleStart: 1426795070410,
parser:
{ _headers: [],
_url: '',
onHeaders: [Function: parserOnHeaders],
onHeadersComplete: [Function: parserOnHeadersComplete],
onBody: [Function: parserOnBody],
onMessageComplete: [Function: parserOnMessageComplete],
socket: [Circular],
incoming: [Object],
maxHeaderPairs: 2000,
onIncoming: [Function] },
ondata: [Function],
_peername: { address: '::ffff:127.0.0.1', family: 'IPv6', port: 55047 },
_httpMessage:
{ domain: null,
_events: [Object],
_maxListeners: 10,
output: [],
outputEncodings: [],
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: true,
_hasBody: true,
_trailer: '',
finished: false,
_hangupClose: false,
socket: [Circular],
connection: [Circular] } },
query: {},
handleJsonResponse: [Function] }
and there's indeed no data
to be found, which explains the node rejection. What I believe the server is expecting is something along those lines:
{"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:4444/grid/register","hubPort":4444,"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}]}
which is standard Selenium Grid request format. I haven't figured out yet why that happens - could it have something to do with the http server implementation that is used here, which comes from q-io
?
@TheFifthFreedom It was fixed here https://github.com/selenodium/selenodium-grid/pull/14.
Try the latest commit from dev
.
Reopening for the gyp-rebuild
@TheFifthFreedom Please open separate issue the next time, to not mix things up ;)
You're right - my mistake, sorry about that!
@TheFifthFreedom Have you figured out how to launch selenodium-grid
?
@TheFifthFreedom I've created a bunch of issues if you want to help. For now all the modifications should be made to the feature/new-registry
branch.
Any update on this? I still have problems on latest version of node
@eranimo No updates for now.
The problem is in the luster-guard
https://github.com/nodules/luster-guard dependency gaze
https://github.com/shama/gaze
Any help is welcomed.
First of all, I'm glad to see someone finally open-sourcing a serious and well-maintained re-implementeation of the Selenium Grid using NodeJS: thanks @arikon ! Now since it seems that
selenodium-grid
is not in the npm registry as of yet, instead of runningnpm -g install selenodium-grid
, I tried to install it manually. However when runningnpm install
(with an updated npm otherwise theˆ
signs inpackage.son
will not be interpreted properly) I encountered an error when trying to rebuild node-gyp:After a bit of digging around, I correlated this issue with this one: https://github.com/TooTallNate/node-gyp/issues/489. This seems to happen on OS X with NodeJS versions beyond 0.10 (I'm running Yosemite 10.10.2 with NodeJS 0.12.0). Just like the issue suggests, downgrading to NodeJS 0.10.X does the trick. So not something you can do much about @arikon, but I thought I'd let you know!