Legacy | Automating Web-apps with Perfecto

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:

    Copy
    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.

Known limitations

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

  • Perfecto Extensions or Visual Analysis.
  • Display on the Perfecto dashboard.

Create 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.

Select desktop web device

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

For example:

Copy
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");
Tip:

Use the Launch Web dialog to generate a code snippet with the capabilities for the desktop-web configuration to use.

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 VM to become available. The number of VMs 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" VMs.

Special notes:

  • The extended VM allocation time (due to queuing) will be reflected in the report as VM 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 VM is available within the network configured time period of 5 minutes, the device allocation request will fail, throwing a device allocation queue timeout exception.

Connect 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, "demo.perfectomobile.com"

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

Automation scripts that use Perfecto's Visual Analysis functionality, or those that require display on the Perfecto Dashboard, should use the following URL string:

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

GitHub samples

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