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 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:
- Entering WebDriver Connection Details
- WebDriver Actions
- Finding WebElements
- WebDriver Mouse and Keyboard Events
WebDriver Connections in Eggplant Functional
In order to use WebDriver commands in SenseTalk
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 |
Configuring Your System
To manually configure Eggplant Functional to work with Selenium on Windows, complete the following steps:
- Download the version of the browser you want to test, or verify the version of the browser if it's already installed.
- Make sure you have a Java version installed (JDK or JRE) that's compatible with your Selenium Standalone Server and browser.
- Create a folder anywhere on the root of your C: drive.
- Download the latest stable version of Selenium Grid (Selenium Standalone Server) on the SUT and place it in the new folder.
- 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.
- Download the appropriate WebDriver for the browser you want to test to that folder.
- Verify your Selenium configuration by executing the *.bat file and verifying that the Selenium server starts as expected.
- 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):
- Open a command prompt.
- Navigate to the .bat file that you created in the previous section.
- 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
- Install the Homebrew iOS package installer:
- Open Terminal and navigate to usr/bin/.
- Run the following command:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- 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 - From a command prompt, run the following command to install the Selenium server: brew install selenium-server-standaloneNote: 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:
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:
- Open a command window.
- Run the following command:sudo nano /etc/paths
- Provide your password.
- 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
- Type Ctrl+X to quit the editor.
- Enter Y to save your changes.
- Press Enter to confirm your changes.
Enable Automation in Safari
To enable automation in the Safari browser, follow these steps:
- Go to Safari > Preferences and select the Advanced tab.
- Select Show Develop menu in menu bar. Close Preferences.
- Go to Develop > Allow Remote Automation.
Note: WebDriver automation with Safari requires macOS Sierra (10.12) or later and Safari 10.0 or later.