Last active
March 4, 2020 22:47
-
-
Save sean-hill/3ceea3f22c074c77a7be2dbb41b36f93 to your computer and use it in GitHub Desktop.
Revisions
-
sean-hill revised this gist
Nov 22, 2016 . 1 changed file with 3 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ var xvfb = new Xvfb({ xvfb_args: ['-screen', '0', '2880x1800x24'] }); exports.boot = function (finished) { async.waterfall([ @@ -95,7 +95,7 @@ function startSelenium(selenium, args, started) { }; function kill() { if (selenium && selenium.children) { @@ -111,16 +111,9 @@ function kill(dontExit) { xvfb.stopSync(); } }; exports.kill = kill; process.on('SIGINT', function(){ console.log('Process SIGINT'); -
sean-hill revised this gist
Nov 22, 2016 . No changes.There are no files selected for viewing
-
sean-hill revised this gist
Nov 22, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ exports.boot = function(finished) { }); }, // 3rd. Start Selenium Grid function (done) { startSelenium(selenium, ['-role', 'hub', '-timeout', '100'], done); }, -
sean-hill revised this gist
Nov 22, 2016 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ var xvfb = new Xvfb({ xvfb_args: ['-screen', '0', '2880x1800x24'] }); exports.boot = function(finished) { async.waterfall([ @@ -95,7 +95,7 @@ function startSelenium(selenium, args, started) { }; function kill(dontExit) { if (selenium && selenium.children) { @@ -120,14 +120,14 @@ function end(dontExit) { }; exports.boot = boot; process.on('SIGINT', function(){ console.log('Process SIGINT'); kill(); }); process.on('SIGTERM', function(){ console.log('Process SIGTERM'); kill(); }); -
sean-hill revised this gist
Nov 22, 2016 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,5 @@ var async = require('async'); var selenium = require('selenium-standalone'); var Xvfb = require('xvfb'); var xvfb = new Xvfb({ displayNum: 99, -
sean-hill revised this gist
Nov 22, 2016 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,6 +39,9 @@ exports.go = function(finished) { // 4th. Start Selenium Nodes function (selenium, done) { // Ideal amount of Selenium Grid nodes on an Amazon m3.large instance var maxNodes = 6; async.times(maxNodes, function(n, next){ var args = ['-role', 'node', '-hub', 'http://localhost:4444/grid/register', '-maxSession', '1']; -
sean-hill revised this gist
Nov 22, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,9 +3,9 @@ var selenium = require('selenium-standalone'); var maxNodes = 6; var Xvfb = require('xvfb'); var xvfb = new Xvfb({ displayNum: 99, reuse: true, xvfb_args: ['-screen', '0', '2880x1800x24'] }); exports.go = function(finished) { -
sean-hill revised this gist
Nov 22, 2016 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,6 @@ var xvfb = new Xvfb({ , xvfb_args: ['-screen', '0', '2880x1800x24'] }); exports.go = function(finished) { async.waterfall([ -
sean-hill created this gist
Nov 22, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ node.js, selenium grid, xvfb, and webdriver.io This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,132 @@ var async = require('async'); var selenium = require('selenium-standalone'); var maxNodes = 6; var Xvfb = require('xvfb'); var xvfb = new Xvfb({ displayNum: 99 , reuse: true , xvfb_args: ['-screen', '0', '2880x1800x24'] }); exports.go = function(finished) { async.waterfall([ // 1st. Start Xvfb function (done) { xvfb.start(function(err){ return done(err); }); }, // 2nd. Install Selenium function (done) { selenium.children = []; selenium.install({ logger: function (message) { console.log('Selenium install:', message); } }, function(err){ return done(err); }); }, // 3rd. Start Selenium Hub function (done) { startSelenium(selenium, ['-role', 'hub', '-timeout', '100'], done); }, // 4th. Start Selenium Nodes function (selenium, done) { async.times(maxNodes, function(n, next){ var args = ['-role', 'node', '-hub', 'http://localhost:4444/grid/register', '-maxSession', '1']; var port = '555' + n; args.push('-port'); args.push(port); startSelenium(selenium, args, next); }, function(){ return done(null, selenium); }); } ], function (err) { if (err) { console.log('Selenium startup error:', err); } else { console.log('Selenium listening!'); } if (finished) { return finished(); } }); }; function startSelenium(selenium, args, started) { selenium.start({ seleniumArgs: args }, function (err, child) { if (err) { return started(err); } child.stderr.on('data', function(data){ console.log(data.toString()); }); selenium.children.push(child); return started(null, selenium); }); }; function end(dontExit) { if (selenium && selenium.children) { for (var i = 0; i < selenium.children.length; i++) { console.log('Killing selenium with PID:', selenium.children[i].pid); selenium.children[i].kill(); }; } if (xvfb) { console.log('Killing xvfb'); xvfb.stopSync(); } if (dontExit) { return; } else { process.exit(1); } }; exports.end = end; process.on('SIGINT', function(){ console.log('Process SIGINT'); end(); }); process.on('SIGTERM', function(){ console.log('Process SIGTERM'); end(); });