Error: cannot open display: :0 for Selenium tests

前端 未结 2 1223
遇见更好的自我
遇见更好的自我 2021-01-24 14:21

Firstly I was getting the following error:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Fi         


        
相关标签:
2条回答
  • 2021-01-24 14:37

    The best approach to solve this problem is making changes to the jenkins start script.

    The solution that works on Ubuntu for me correctly is as follows:

    1.Open Jenkins shell script located at: /etc/init.d/jenkins.

    2.Add the following lines as follows before PATH variable:

    /usr/bin/X :0 vt7 -ac
    export DISPLAY=:0
    xhost +
    
    0 讨论(0)
  • 2021-01-24 14:51

    You can download the Jenkins xvnc plugin and make that plugin start(and export) a virtual display for selenium to use. The jenkins user may not have access to the :0 display.

    0 讨论(0)
提交回复
热议问题