Error: no DISPLAY environment variable specified

12,175

Solution 1

Just try to set environment variable DISPLAY please.

Your question is a bit duplicated with Selenium Error: no display specified

Solution 2

Check out the link provided by @peter-quan. And you will face this issue if you are running the node connection from SSH.

In addition to this, I am adding the commands that helped me to solve the issue.

sudo apt-get install xvfb
touch ~/.Xauthority
xauth generate :0 . trusted
xauth add ${HOST}:0 . $(xxd -l 16 -p /dev/urandom)
xauth list
export DISPLAY=:0
java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://[HUB-IP]:4444/grid/register/
Share:
12,175
Himadri Ganguly
Author by

Himadri Ganguly

A technophile by heart and profession with strong communication, coordination, and systematic planning skills with more than 10 years of experience. Always love to be a good team player in any project for the betterment of the project and smooth execution. Love to share knowledge with others to gain knowledge as well. Always try and learn new technologies. A very good self-learner.

Updated on June 04, 2022

Comments

  • Himadri Ganguly
    Himadri Ganguly almost 2 years

    I have set up one Selenium Grid with one Hub in Ubuntu Server and one Node in Ubuntu Desktop. Installed Geckodriver and Firefox on the Node machine. And using the following python code.

    from selenium import webdriver
    from selenium.webdriver.firefox.options import Options as FirefoxOptions
    
    options = webdriver.FirefoxOptions()
    driver = webdriver.Remote(
        command_executor='http://192.168.56.7:4444/wd/hub',
        options=options
    )
    

    But getting error Error: no DISPLAY environment variable specified on the Node machine.

    Working exactly fine after adding

    options.add_argument('--headless')
    

    Don't want to run it in headless mode.

    Thanks to all in advance.

  • Zain Ul Abidin
    Zain Ul Abidin over 2 years
    the above instructions worked thanks .