Nodejs on Ubuntu

Has anyone had any luck with getting this running? I’ve got the agent running and getting jobs from the server but the test just reports:

The test completed but there were no successful results.

The output on the agent node indicates a few errors, I think the below is probably the first showstopper but have attached the full output. Any input on this at all is greatly appreciated:

D Jun_23_14:27:39.966 browser_base.js:141 createBrowser : Creating browser browser_local_chrome.BrowserLocalChrome
I Jun_23_14:27:39.974 browser_local_chrome.js:53 new BrowserLocalChrome : BrowserLocalChrome(/root/speed/agent/js/lib/webdriver/chromedriver/Linux x86_64/chromedriver-2.4, undefined)
I Jun_23_14:27:40.038 process_utils.js:365 unknown : Spawning: chrome --disable-fre --enable-benchmarking --metrics-recording-only ‘-remote-debugging-port=1234’
E Jun_23_14:27:40.048 wd_server.js:987 WebDriverServer. : Top-level process uncaught exception: spawn ENOENT
W Jun_23_14:27:40.053 process_utils.js:371 Socket. : chrome STDERR: execvp(): No such file or directory
E Jun_23_14:27:40.059 wd_server.js:195 WebDriverServer. : Exception from “Run test”: Error: spawn ENOENT
D Jun_23_14:27:40.060 wd_server.js:196 WebDriverServer. : Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)

It looks like that might be related to how the command-line is assembled:

I know there was a recent change to the node agent (unrelated - adding another command-line option) that changed how the command-line is built and may have fixed the issue.

It looks like it is trying to launch chrome using chrome as opposed to google-chrome, iv created a symlink from chrome to google-chrome and it is now throwing different errors which I think might be related to trying to launch chrome on a linux server without a gui - same occurs when just trying to launch chrome manually:

I Jun_24_11:37:42.996 process_utils.js:366 unknown : Spawning: chrome [ ‘–disable-fre’,
‘-remote-debugging-port=1234’ ] undefined
W Jun_24_11:37:43.027 process_utils.js:372 Socket. : chrome STDERR: /usr/bin/chrome: line 73: /dev/fd/62: No such file or directory
/usr/bin/chrome: line 74: /dev/fd/62: No such file or directory
W Jun_24_11:37:43.079 process_utils.js:372 Socket. : chrome STDERR: [0624/] Failed to create /root/.pki/nssdb directory.
E Jun_24_11:37:53.061 wd_server.js:195 WebDriverServer. : Exception from “Run test”: Error: Connect DevTools
Wait timed out after 10014ms
D Jun_24_11:37:53.061 wd_server.js:196 WebDriverServer. : Error: Connect DevTools

I’ve installed xvfb which allows you to run chrome in a headless fashion, tested ok:

Im going to try and munge the above xvfb cmd into the code but my js skills are almost non existent so if anyone has any suggestions about how to best integrate this or any alternative methods they would be very welcome.

I got chrome to launch by putting the xvfb command that launches google-chrome into the /usr/bin/chrome file but for some reason it doesnt open the debug port and it fails to connect to devtools:

I Jun_24_21:43:37.093 browser_local_chrome.js:53 new BrowserLocalChrome : BrowserLocalChrome(/home/test/speed/webpagetest-master/agent/js/lib/webdriver/chromedriver/Linux x86_64/chromedriver-2.4, undefined)
I Jun_24_21:43:37.166 process_utils.js:366 unknown : Spawning: chrome [ ‘–disable-fre’,
‘-remote-debugging-port=1234’ ] undefined
I Jun_24_21:43:37.180 browser_base.js:65 BrowserLocalChrome. : Chrome EXIT code 0 signal null
I Jun_24_21:43:37.201 wd_server.js:254 WebDriverServer. : DTURL: http://localhost:1234/json

I Jun_24_21:43:45.354

E Jun_24_21:43:47.214 wd_server.js:195 WebDriverServer. : Exception from “Run test”: Error: Connect DevTools
Wait timed out after 10005ms
D Jun_24_21:43:47.216 wd_server.js:196 WebDriverServer. : Error: Connect DevTools
Wait timed out after 10005ms

Iv tested just running chrome in a screen using the --remote-debugging-port=1234 arg both with and without xvfb, I can see the chrome process running in ps faux and top but netstat shows no ports open on 1234 (which it does when doing the same test on my desktop) so i cant connect via telnet or curl either.

So I think this looks to be an issue getting the debug port working on chrome in an ubuntu server environment. It might be a first launch thing preventing chrome from fully initialising. If I have any joy i’ll update the post.

I managed to get a result using 32bit Debian Wheezy but for some reason the second test run is still failing in the same manner as the first was previously. I was previously using 64bit versions of Ubuntu Server so this may be a 32bit vs 64bit issue I was seeing before.

As a hack to test if using xvfb would work I chopped out the args and options variables from the spawn function (process_utils.js:366) and hard set the args in the xvfb command:

killall chrome -9
killall xvfb -9
killall Xvfb -9
killall xvfb-run -9
cd /home/test/
sudo -u test xvfb-run --server-args=’-screen 0, 1024x768x16’ google-chrome -start-maximized --disable-fre --enable-benchmarking --metrics-recording-only --remote-debugging-port=1234 > /dev/null &

This is the only way I’ve been able to get chrome running properly with devtools in a headless environment but im guessing this is causing the second run to fail for some reason. I’ve attached the full output.

The above xvfb solution could be implemented a little more elegantly however if you have any idea’s as to the probable cause of the second run failing it would be very helpful. Would it normally close and respawn chrome or use the existing session? Are different args/options ever used when spawning chrome?

Any help is appreciated on this its so close!! Im happy to document the full process of getting this far if we can get this working as there are a few tweaks required.



Running inside xvfb has done the trick, second run works fine, no removing js or dodgy xvfb chrome script required. Screenshots arnt working for some reason but this isnt too much a of a problem for me. I needed to install all the packages defined in this article to get it working: