How do I run Selenium in Xvfb?

前端 未结 5 1807
面向向阳花
面向向阳花 2020-11-22 08:21

I\'m on EC2 instance. So there is no GUI.

$pip install selenium
$sudo apt-get install firefox xvfb

Then I do this:

$Xvfb :1         


        
5条回答
  •  梦如初夏
    2020-11-22 09:11

    open a terminal and run this command xhost +. This commands needs to be run every time you restart your machine. If everything works fine may be you can add this to startup commands

    Also make sure in your /etc/environment file there is a line

    export DISPLAY=:0.0 
    

    And then, run your tests to see if your issue is resolved.

    All please note the comment from sardathrion below before using this.

提交回复
热议问题