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:
- 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
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.
To configure Eggplant Functional
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.
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.
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:
- Go to Eggplant Functional Downloads.
- Download and run the WebDriver Server (WebDriverServerSetup.exe).
- Follow the on-screen instructions to install the Selenium WebDriver.
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:
- Open a command prompt.
- Navigate to the C:\Program Files\WebDriverServer directory.
- 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.