Running headless Chrome on a remote virtual machine (E.g on EC2) ?

1,240 views
Skip to first unread message

Ali Akhtar

unread,
Aug 14, 2015, 5:24:30 PM8/14/15
to Chromium-dev
I'd like to programatically launch chrome, interact with it via the debugger protocol, and collect metrics on what happened. This needs to happen on a Linux VM on AWS EC2.

Initial googling led me to try xvbf, which I've tried, but it gives a bunch of cryptic errors related to GPU or frames.

If anyone's been able to get xvbf or another way of launching headless chrome working on a cloud server, could you please share your command / any other info?

Thanks.

Sunny Sachanandani

unread,
Aug 14, 2015, 5:34:32 PM8/14/15
to ali.r...@gmail.com, Chromium-dev
You might want to try chrome remote desktop. It also runs on xvfb but a special patched version AFAIK.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Ali Akhtar

unread,
Aug 14, 2015, 6:59:04 PM8/14/15
to Sunny Sachanandani, Chromium-dev
Does anyone have any info on how to run it with xvbf?

Scott Violet

unread,
Aug 14, 2015, 7:04:29 PM8/14/15
to ali.r...@gmail.com, Sunny Sachanandani, Chromium-dev
xvfb works for me and is used on some bots. You'll want to build
xdisplaycheck, and then it's just a matter of something like:
./testing/xvfb.py out/Debug what-you-want-to-run.

-Scott

Ali Akhtar

unread,
Aug 14, 2015, 7:08:35 PM8/14/15
to Scott Violet, Sunny Sachanandani, Chromium-dev
What does xdisplaycheck do, and how would I build it? Is it necessary to build it, or can I do whatever it does manually?

(Sorry, a bit new to this)

Scott Violet

unread,
Aug 14, 2015, 7:15:19 PM8/14/15
to Ali Akhtar, Sunny Sachanandani, Chromium-dev
https://chromium.googlesource.com/chromium/src/+/master/tools/xdisplaycheck/

Pass xdisplaycheck to ninja to build it. What does it do? I can only
guess based on the name. xvfb.py makes use of it, which is why it
needs to be built.

-Scott

Ali Akhtar

unread,
Aug 14, 2015, 7:18:27 PM8/14/15
to Scott Violet, Sunny Sachanandani, Chromium-dev
Thanks Scott,

Looking over xvbf.py , it seems like its just checking the OS, and then building the string to call xbvf. So, I can probably read the code and figure out what string it would build for my OS, and then try to run that string directly.

Will post here with an update / full command for running xvbf if I get it working.

Ali Akhtar

unread,
Aug 19, 2015, 6:47:54 PM8/19/15
to Scott Violet, Sunny Sachanandani, Chromium-dev
So, the following command is working for me on my laptop:

xvfb-run -a -e /dev/stdout --server-args='-screen 0, 1024x768x24' google-chrome-beta --remote-debugging-port=8080

When this works, I can see the debugging console at localhost:8080 and localhost:8080/json

However, while this works without errors on the laptop, on my VM in the cloud, I'm getting errors about dBus, specifically:

> [8930:8930:0819/224547:ERROR:sandbox_linux.cc(345)] InitializeSandbox() called with multiple threads in process gpu-process

> (google-chrome-beta:8896): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
//bin/dbus-launch terminated abnormally without any error message

> (google-chrome-beta:8896): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process "dbus-launch" (No such file or directory)

However, I'm still able to connect to localhost:8080/json and pull the info on the tabs, even despite this error.

So, is the dBus stuff important, or can it be ignored? 
Reply all
Reply to author
Forward
0 new messages