“To provide the best experience for the most-used Linux versions, we will end support for Google Chrome on 32-bit Linux, Ubuntu Precise (12.04), and Debian 7 (wheezy) in early March, 2016. Google Chrome 32 Bit Linux free download - Google Chrome (64-bit), Google Chrome Portable, Google Chrome beta, and many more programs.
This tutorial will help you to setup Selenium with ChromeDriver on Debian 9 and Debian 8. This tutorial also includes an example of a Java program which uses Selenium standalone server and ChromeDriver and runs a sample test case.
Xvfb (X virtual framebuffer) is an in-memory display server for a UNIX-like operating system (e.g., Linux). It implements the X11 display server protocol without any display. This is helpful for CLI applications like CI service.
Login to your Debian system as sudo privileged user and execute the following commands to install required packages on your system.
Also, install Java on your system. Use below command to install OpenJDK on your system, If you like install Oracle Java 8 on your Debian system.
Now install Latest Google chrome on your Debian system using commands below. Google chrome headless feature opens multipe doors for the automation.
ChromeDriver is a standalone server which implements WebDriver’s wire protocol for Chromium. The WebDriver is an open source tool for automated testing of web apps across multiple browsers.
You can find the latest ChromeDriver on its official download page. Now execute below commands to configure ChromeDriver on your system.
The Selenium Server is required to run Remote Selenium WebDrivers. You need to download the Selenium standalone server jar file using the below commands or visit here to find the latest version of Jar file.
Also, download the testng-6.8.7.jar file to your system.
Your server setup is ready. Start the Chrome via standalone selenium server using Xvfb utility.
Run Chrome via Selenium Server
Use -debug
option at end of command to start server in debug mode.
You can also Start Headless ChromeDriver by typing the below command on terminal.
Your Selenium server is now running with Chrome. Use this server to run your test cases written in Selenium using Google Chrome web browser. Next step is an optional step and doesn’t depend on Step 5.
This is an optional step. It describes running a single test case using Selenium standalone server and ChromeDriver. Let’s create a Java program using the Selenium server and Chrome Driver. This Java program will open a specified website URL and check if defined string presents on the webpage or not.
Create a Java program by editing a file in text editor.
Add the below content to file.
2 4 6 8 10 12 14 16 18 20 22 24 26 | importorg.openqa.selenium.chrome.ChromeOptions; importorg.testng.annotations.Test; publicclassTecAdminSeleniumTest{ publicstaticvoidmain(String[]args)throwsIOException,InterruptedException{ System.setProperty('webdriver.chrome.driver','/usr/bin/chromedriver'); chromeOptions.addArguments('--headless'); driver.get('https://google.com'); if(driver.getPageSource().contains('I'm Feeling Lucky')){ }else{ } } |
You can change the URL “https://google.com” with any other URL of your choice, Then also change the search string like “I’m Feeling Lucky” used in the above Java program. Save your java program and execute it. First, you need to set the Java CLASSPATH environment variable including the selenium-server-standalone.jar and testng-6.8.7.jar. Then compile the java program and run it.
You will see results like below. If the defined search string found, You will get message “Pass” and if string not found on the webpage, you will get the “Fail” message on the screen.