Selenium WebDriver Testing with Eggplant Functional

The Selenium suite of tools is specifically designed for object-based automated testing of web browsers and web applications. You can use Eggplant Functional to perform Selenium WebDriver testing on its own or in combination with testing through VNC or RDP connections for image-based testing to achieve a hybrid approach.

To do WebDriver testing, first set up Selenium in your environment:

Next, add a WebDriver connection to the Eggplant Functional Connection List, then use SenseTalk commands and functions to create your tests:

WebDriver Connections in Eggplant Functional

In order to use WebDriver commands in SenseTalk, you first must install the Selenium server and the appropriate driver for your browser on the system under test (SUT). 

The Selenium server sends WebDriver commands and functions from Eggplant Functional to a driver that is specific to the browser you're using. This driver uses these commands to control and test the web page. The driver returns the test results through the Selenium server to Eggplant Functional.

Configuring Selenium on Windows

To configure Eggplant Functional to work with the Selenium framework on Windows, you must install the Selenium Standalone Server, Java (JDK or JRE), and the appropriate WebDriver for any browser you want to test against.

Compatible Windows Configurations

Eggplant has tested these configurations of WebDriver for use with Eggplant Functional on a Windows 10 SUT.

SUT Browser Browser Driver (WebDriver) Selenium Standalone Server Java
Chrome 86.0.4240.183 Chromedriver 85.0.4183.83 3.12 JDK 14.0.2
Edge 86.0.623.63 MSEdgeDriver 86.0.622.63 3.12 JDK 14.0.2
Firefox 79 GeckoDriver 3.12 JDK 14.0.2
Note: Edge Chromium is not supported.

Configuring Your System

To manually configure Eggplant Functional to work with Selenium on Windows, complete the following steps:

  1. Download the version of the browser you want to test, or verify the version of the browser if it's already installed.
  2. Make sure you have a Java version installed (JDK or JRE) that's compatible with your Selenium Standalone Server and browser.
  3. Create a folder anywhere on the root of your C: drive.
  4. Download the latest stable version of Selenium Grid (Selenium Standalone Server) on the SUT and place it in the new folder.
  5. Create a *.bat file, name it something like "RunSeleniumServer.bat", and add the following information:

    @echo off

    set JAVA_HOME=C:\Program Files\Java\jdk********\bin

    "%JAVA_HOME%\java" -jar selenium-server-standalone-^^^^^^.jar

    where ***** is the version of the JDK and ^^^^^^ is the version of the Selenium Standalone Server that you have installed.

  6. Download the appropriate WebDriver for the browser you want to test to that folder.
  7. Verify your Selenium configuration by executing the *.bat file and verifying that the Selenium server starts as expected.
  8. Verify that you can establish a WebDriver connection to the Selenium environment using Eggplant Functional.

Starting and Stopping the Selenium Standalone Server

To start the Selenium Standalone Server (if it's not already runnning):

  1. Open a command prompt.
  2. Navigate to the .bat file that you created in the previous section.
  3. Run the .bat file.

To stop the Selenium server, close the command shell in which the Selenium server is running.

Configuring Selenium on Mac

To configure Eggplant Functional to work with the Selenium framework on a Mac, you must install the Selenium server, the Java SE Development Kit (JDK), and the appropriate WebDriver for any browser you want to test against.

Compatible Mac Configurations

Eggplant has tested these configurations of WebDriver for use with Eggplant Functional.

SUT Browser Browser Driver (WebDriver) Selenium Server Java
Chrome 84 ChromeDriver 3.12 JDK 14.02
Safari 12.0.2 Safaridriver 3.141.59 openjdk 11.0.2

The following examples use ChromeDriver, the WebDriver for the Google Chrome browser.

Install the Selenium Server and the Oracle JDK

  1.  Install the Homebrew iOS package installer:
    1. Open Terminal and navigate to usr/bin/.
    2. Run the following command:
      ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Usually the JDK is already installed on a Mac. If necessary, download and install the JDK from Oracle.

    Tip: To install Java using Homebrew, run the following command:

    brew cask install java
  3. From a command prompt, run the following command to install the Selenium server:
    brew install selenium-server-standalone
    Note: From a command prompt, run the following command to verify that the Selenium server is installed correctly.
    selenium-server --version

    The command should return the Selenium server version that you just installed.

Starting and Stopping the Selenium Server

From a command prompt, run the following command to start the Selenium server:

selenium-server -port 4444
Note: Run this command any time you need to start the Selenium server.
Note: The Terminal window must remain open for the Selenium server to be active and for WebDriver functionality to be available through SenseTalk.

To stop the Selenium server, close the terminal that you used to start the Selenium server.

Install ChromeDriver

For compatibility with Eggplant Functional, you must use Chrome version 60 or later and ChromeDriver version 2.33 or later. Download the WebDriver for Chrome, then complete the following steps to let the Selenium server know the location of ChromeDriver:

  1. Open a command window.
  2. Run the following command:
    sudo nano /etc/paths
  3. Provide your password.
  4. Navigate to the bottom of the file and enter the path to ChromeDriver. For example, your path might look like the following:
    /Users/<username>/Documents
  5. Type Ctrl+X to quit the editor.
  6. Enter Y to save your changes.
  7. Press Enter to confirm your changes.

Enable Automation in Safari

To enable automation in the Safari browser, follow these steps:

  1. Go to Safari > Preferences and select the Advanced tab.
  2. Select Show Develop menu in menu bar. Close Preferences.
  3. Go to Develop > Allow Remote Automation.

Note: WebDriver automation with Safari requires macOS Sierra (10.12) or later and Safari 10.0 or later.

 

This topic was last updated on August 19, 2021, at 03:30:51 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant