Page tree
Skip to end of metadata
Go to start of metadata

Last updated: May 01, 2019 23:20

Existing Selenium Scripts

Reworking your Selenium script for automating a desktop-web device in the Perfecto Lab, requires a few simple steps:

  • Supply your security token as the value of the securityToken capability:

    capabilities.setCapability("securityToken", "eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI1NTg2MjBmZi1lMTAyLTRlNDAt...QIalYCHkgEQQU0IB_6CO6fQ");
  • Select a desktop web device from the Perfecto Lab.

  • Provide the Perfecto Lab URL when creating the RemoteWebDriver instance.

Creating Perfecto Selenium Scripts

To create a Selenium script in the Perfecto environment:

  • Prepare your environment for desktop web devices -
    • Acquire licenses for the desktop-web devices needed from Perfecto (available only for hosted Perfecto Lab installations).
    • Download and install the Perfecto plugin for your development environment.
  • Use Selenium to write your automation script with the following minor modifications -
  • Provide the Perfecto Lab URL when creating the RemoteWebDriver instance.

  • Incorporate DigitalZoom Reporting tools to add more information to your execution reports.

Selecting Desktop-Web Device

The Desktop-Web device characteristics are defined by the device capabilities presented when the automation driver is created.

For example,

capabilities.setCapability("platformName", "Windows");
capabilities.setCapability("platformVersion", "10");
capabilities.setCapability("browserName", "Firefox");
capabilities.setCapability("version", "latest");
capabilities.setCapability("resolution", "1280x1024");
capabilities.setCapability("location", "US East");

Best Practice: Use the Launch Web dialogue to generate a code snippet with the capabilities for the desktop-web configuration to use.

The number of devices for Desktop Web testing is limited by the license you purchase from Perfecto. If you run several tests in parallel there is a possibility that you may exceed the number of "available" licensed devices. When the script requests to allocate a desktop-web device and no conformant device is available, the system will queue the request. The queued request will wait up-to 5 minutes for a device to become available.

Special notes:

  • The extended allocation time (due to queuing) will be reflected in the report as device allocation time.
  • Various network configuration settings may affect the ability of the system to queue the allocation request for the full 5 minutes.
  • If no licensed device becomes available within the network configured time period of 5 minutes, the device allocation request will fail, throwing a device allocation queue timeout exception.

Connecting to RemoteWebDriver URL

When creating the instance of the RemoteWebDriver supply the URL of the Perfecto Lab. The general structure of the URL string is:

"https://" + host + "/nexperience/perfectomobile/wd/hub/fast" 

Where: host is the identifier of the specific Perfecto Lab - for example, ""

driver = new RemoteWebDriver(new URL("https://" + host + "/nexperience/perfectomobile/wd/hub/fast"), capabilities);

GitHub Samples

Browse our Java samples, C# samples, Python samples, Ruby samples, JavaScript samples.

Known Limitations

Automation scripts that instantiate the RemoteWebDriver using the URL with "/fast" appended do not support:

  • Perfecto Extensions for Visual Analysis.