starting headless firefox with Xvfb does not work

2019-06-13 22:20发布

问题:

I try to run firefox in headless mode for selenium.

$xvfb-run firefox seems to work.

I run firefox through selenium so i cannot run xvfb-run directly.

So i start

Xvfb :1 -screen 0 1024x768x24 &

and then

set DISPLAY:=1 env DISPLAY:=1

Still when i run firefox i get

Error: no display specified

I run on centos 6 and firefox 38 ESR.

What can be done?

回答1:

can you try that? export DISPLAY=:1



回答2:

start firefox with --display arg

/usr/bin/firefox --display=:1