Install Selenium Webdrive on an Ubuntu Cloud Server

Im Durchschnitt wird dieses Tutorial Install Selenium Webdrive on an Ubuntu Cloud Server mit 5 bewertet, wobei 1.0 die schlechteste und 5.0 die beste Bewertung ist. Es haben insgesamt 277 Besucher eine Bewertung abgegeben.
276 1

Install Selenium Webdrive on an Ubuntu Cloud Server

Ubuntu
Install Selenium Webdrive on an ubuntu Cloud Server

Every web developer knows the problem: Code is interpreted differently in every browser. With Selenium, the code can be tested automatically for different browsers.

The advantages are obvious: It is not necessary to install a lot of different browsers and not to repeat the same process over and over again. This can be automated with Selenium.

In this tutorial I show you how to create your own selenium server. As a base I take an Ubuntu Server 16.04 LTS. With gridscale, you can create your own Ubuntu server within seconds. This is immediately available online and will be billed minutes – ideal for testing!

If you are new to gridscale, please read our [How-To-Gridscale article]. Many of the most common questions are answered directly here.

Prepare the server

As before every installation you should bring your server up to date. For Debian-based distributions, this is easy to do with the following command:

apt -y update; apt -y upgrade; apt -y dist-upgrade

Like so many Selenium based on Java. Therefore, a Java engine of your choice must be installed. For the sake of simplicity I take OpenJDK; it is already included in the standard repository and is also recommended by the selenium developers. Besides, Selinum still needs a few libs. Use the following command to install everything:

apt-get install -y openjdk-8-jre-headless xvfb libxi6 libgconf-2-4 zip

In order for Selenium to simulate the various browsers, their engines and drivers are still needed. As an example, I show you how to install Chrome. The other browsers are installed similarly.

Download the Chrome.deb first:

wget -N https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -P ~/

It is then installed:

dpkg -i --force-depends ~/google-chrome-stable_current_amd64.deb
apt-get -f install -y
dpkg -i --force-depends ~/google-chrome-stable_current_amd64.deb

Then you need the ChromeDriver:

wget -N https://chromedriver.storage.googleapis.com/2.9/chromedriver_linux64.zip -P ~/

Unpack the ZIP file with Unzip:

unzip ~/chromedriver_linux64.zip -d ~/

After unpacking, the package is no longer needed. Delete it with the following command:

rm ~/chromedriver_linux64.zip

Following move the driver to the correct directory and authorize the system to run the file:

mv -f ~/chromedriver /usr/local/share/
chmod +x /usr/local/share/chromedriver

Then a symlink is needed:

ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver

Install Selenium

After all preparations have been successfully completed, you can now install Selenium. Download the latest version:

wget -N http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar -P ~/

Afterwards move the JAR into the correct directory and make it executable. Here again you create a SymLink:

mv -f ~/selenium-server-standalone-3.4.0.jar /usr/local/share/
chmod +x /usr/local/share/selenium-server-standalone-3.4.0.jar
ln -s /usr/local/share/selenium-server-standalone-3.4.0.jar /usr/local/bin/selenium-server-standalone-3.4.0.jar

That’s it already. Selenium is now ready. To start the service easy, you should put a simple small script. If you put it under /bin, you can start it from anywhere:

nano /bin/selenium

Insert the following code and save the file:

#!/usr/bin/env bash
xvfb-run java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/bin/selenium-server-standalone-3.4.0.jar

You can do this with:

chmod +x /bin/selenium

Start Selenium

With the command “selenium” you can now start the service from anywhere.

Then you can open the following URL in your browser to check the installation:

http://<yourIP>:4444/wd/hub/static/resource/hub.html

How to get to the Session Overview:

Session Overview

Summary

Setting up selenium is done quite quickly, but only with the web interface and via the console is relatively little to begin with. With a CD tool of your choice, such as Jenkins or Buddy, you can save your selenium server for automation and thus exploit the full potential.

Every web developer knows the problem: Code is interpreted differently in every browser. With Selenium, the code can be tested automatically for different browsers. The advantages are obvious: It is not necessary to install a lot of different browsers and not to repeat the same process over and over again. This can be automated with […]

Schade, dass dir der Artikel nicht gefallen hat.
Was sollten wir deiner Meinung nach besser machen?

Thank you for your feedback!
We will get back to you as soon as the article is finished.

Übrigens: kennst du schon unser Tutorial zum Thema Install WordPress on Ubuntu or Debian?

×

Developer?

Get the latest gridscale developer tutorials here.
And don’t worry - we won’t spam you