Selenium

To learn how to run Java Selenium scripts in Perfecto, review the following information.

The following setup information is based on a sample project available on GitHub, created to help you get up and running with Selenium and Perfecto. The project is a working example that demonstrates how to configure and run Selenium tests in a Perfecto environment, making it easier to understand the setup and adapt it to your own use cases.

Important: The sample project is fully compatible with Appium 2 and continues to use the desiredCapabilities format to support teams transitioning from earlier versions of Appium and Selenium. For teams adopting Appium 2 from scratch, consider using the options-based syntax, now standard in both Appium 2 and Selenium, to algin with the W3C WebDriver specification. For guidance on adopting this approach, see the official Appium 2 and Selenium documentation.

To run a Selenium WebDriver test with Java in Perfecto, you should:

  • Be familiar with Selenium
  • Have existing tests to work with
  • Be a novice user of Perfecto

The setup process involves modifying your existing scripts to include:

  • What driver you want to use
  • Where your Perfecto instance is located 
  • Who you are
  • What devices you want to work on

For information on running the final script, see the README.md file included with the sample project.

Important: This document includes references to third-party products, Eclipse IDE and IntelliJ IDEA. The user interface and usage of third-party products are subject to change without notice. For the latest published information about Eclipse IDE, see https://www.eclipse.org/documentation. For the latest published information about IntelliJ IDEA, see https://www.jetbrains.com/help/idea/getting-started.html.

Prerequisites

Before you get started, make sure you have installed the following:

  • Java 11

  • An IDE of your choice, such as Eclipse or IntelliJ IDEA (consider using IntelliJ IDEA for a better Appium and Maven integration)

  • Maven

Additional setup per IDE

If you use Eclipse with the following:

If you use IntelliJ IDEA with Apache Maven, install the Maven plugin for IDEA. IntelliJ IDEA versions 7 and later include the TestNG plugin as a built-in plugin.

Optional installations

For source control management, you can install git.

This plugin is usually bundled with the IDE, but ensure it is enabled.

1 | Get started

  1. Access the sample project in GitHub and copy the  clone URL.
  2. Open your IDE and check out the project from GitHub.

2 | Configure the script for Perfecto

In this step, we update the pom.xml file with the Perfecto dependencies and add security information, the Perfecto cloud name, driver details, Smart Reporting information, and test data.

The updated script example is called PerfectoSelenium.java. The following procedure walks you through the configuration. The script can be used with any Java-based testing framework.

Expand a step to view its content.