Skip to content

Instantly share code, notes, and snippets.

@cray0000
Last active June 19, 2016 02:51
Show Gist options
  • Save cray0000/d722e5d1873be882e082cc67a5c2d876 to your computer and use it in GitHub Desktop.
Save cray0000/d722e5d1873be882e082cc67a5c2d876 to your computer and use it in GitHub Desktop.
Setting up selenium grid

Preparation

  1. Install selenium

    wget http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.0.jar
    
  2. Install chromedriver

    sudo apt-get install -y unzip
    curl -Lo chromedriver.zip http://chromedriver.storage.googleapis.com/2.22/chromedriver_linux64.zip && unzip chromedriver.zip && chmod a+x chromedriver
    sudo cp chromedriver /usr/bin/chromedriver
    
  3. Install chrome-browser

    http://askubuntu.com/questions/79280/how-to-install-chrome-browser-properly-via-command-line

  4. Install virtual X server

    sudo apt-get install xvfb 
    
  5. Fix issue with selenium node registration

    sudo apt-get install -y haveged
    sudo service haveged start
    sudo update-rc.d haveged defaults
    

Running tests

In separate terminals run:

  1. Selenium Hub (which accepts requests from test framework):

    java -jar selenium-server-standalone-2.53.0.jar -role hub -timeout 300
    
  2. Selenium Node (which will run the browsers) together with virtual X server. Following allows to run 30 chrome browsers:

    DISPLAY=:1 xvfb-run java -jar selenium-server-standalone-2.53.0.jar -role node -hub http://localhost:4444/grid/register -browser browserName=chrome,maxInstances=30 -maxSession 30
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment