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.

New feature: WebDriver testing is available in Eggplant Functional 18.0 and later.

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). Automation and communication between Eggplant Functional and the SUT work roughly in this way:

SenseTalk <==> Selenium Server <==> Browser Drivers <==> Web Page

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.

After you follow the steps below to install the Selenium server on your Mac or Windows SUTs, you can send WebDriver Commands and Functions in Eggplant Functional to test web pages.

Note: Eggplant Functional works with Selenium Server 2.0, which is also known as Selenium WebDriver. You can use any browser supported by Selenium Server 2.0. Typically, you need to install a driver for each browser type you want to use.

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. These examples use ChromeDriver 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

ChromeDriver is the WebDriver tool for use with Google Chrome. Note that 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.

Configuring Selenium on Windows

A WebDriver Server setup file for Windows is available from the Eggplant Functional Downloads page. When you run the file, WebDriverServerSetup.exe, it installs the Selenium WebDriver server, the Oracle Java SE Run Time Environment (JRE), and WebDrivers for Internet Explorer, Edge, and Chrome browsers. Complete these steps to configure Selenium for Eggplant Functional:

  1. Go to Eggplant Functional Downloads.
  2. Download and run WebDriverServerSetup.exe.
  3. Follow the on-screen instructions to install the Selenium WebDriver. Click Finish after the installation completes.
Note: You can manually install the Selenium server, the JRE, and the browser drivers if you prefer.

Starting and Stopping the Selenium Server

To start the Selenium server, do one of the following:

  • Select Run Selenium Server from the Start > WebDriverServer program group.
  • Do the following to start the Selenium Server manually:

    1. Open a command prompt.
    2. Navigate to the C:\Program Files\WebDriverServer directory.
    3. Run the Selenium server by typing the following command and pressing enter:
      RunSeleniumServer

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

Removing the Selenium Configuration

Select Uninstall WebDriverServer from the Start > WebDriverServer program group and follow the instructions to remove the Selenium configuration.

Note: This removal step doesn't remove the JRE that was installed when you completed the steps shown in Configuring Selenium on Windows.

 

This topic was last updated on February 06, 2018, at 02:10:38 PM.