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

Last updated: Jan 12, 2021 11:41

For the purpose of script development and debugging, you can open a device in the Perfecto Lab and share that session with your favorite IDE. Session sharing allows you to work interactively on the device in the Perfecto Lab while simultaneously executing an Appium or Selenium script from your IDE. 

Step-by-step instructions

What kind of session do you want to share? Expand the corresponding steps.

Notes:

  • When you use a new device or start a new Perfecto Lab session, you need a new session ID.
  • If you intend to run your script outside of session sharing, before committing, remove these capabilities from the script code. Otherwise, your script will fail.

On this page:

Mobile device


To share the session ID:

  1. In the Manual Testing view, open a mobile device.

  2. On the device tab, in the device toolbar, click the Copy Session ID icon.

  3. In the Copy session ID form, copy the session ID or capability code sample to the clipboard.

  4. In your IDE, add the deviceSessionID capability to your script and paste the session ID as the value.

    Session ID example
    3d3718b8-0700-4ecb-99dd-71c1def7138b
    deviceSessionId capability example
    capabilities.setCapability("deviceSessionId", "3d3718b8-0700-4ecb-99dd-71c1def7138b");
  5. If you have 2 or more devices open, also specify the device ID to use (same as you would do if running a test on a device without the device being open in Perfecto), as follows:

    1. On the device toolbar, click the information icon .

    2. In the device info form, on the Device tab, copy the Device ID.
    3. In your IDE, add the deviceName capability to your script.

      deviceName capability example
      capabilities.setCapability("deviceName", "00008030-001D29661488802E");
  6. Run your test. This performs all your test steps on the device in real-time.
  7. Access your test report. The report becomes available when you release the device.
Desktop web

Watch the following video to see how to copy a session ID and include it in a script.

To share the session ID:

  1. In the Manual Testing view, in the left pane, select the Web folder.

  2. Click OPEN NEW WEB SESSION.

  3. In the Open new web session form, do the following:

    1. Select the I will use this session to debug my automation script checkbox.

    2. Select your session parameters, including platform, browser, version, resolution, and location.
    3. Click OPEN.
  4. On the session tab, on the session toolbar, click the Copy session ID button  (this button is only available if you selected the checkbox in step 3a).

  5. In the Copy session ID form, below the session ID, click Copy to clipboard.

  6. In your IDE, add the deviceSessionID capability to your script and paste the session ID as the value.

    deviceSessionId capability example
    capabilities.setCapability("deviceSessionId", "48402b47-2281-4bc6-9877-f446f81a5dfc");
  7. Run your test. This performs all your test steps on the device in real-time.
  8. Access your test report. The report becomes available when you release the device.

Limitations

  • At this point, session sharing for desktop web is only available for Windows machines.
  • When the deviceSessionId capability is used along with other capabilities, the only capability that takes effect is deviceSessionId. Other capabilities (such as install app or open app) are ignored. You can use the Perfecto driver.executeScript to code these and other actions (for more information, see Execute proprietary functions). For example, if you want to install an application as part of the shared session, you can use the following code: 
    //declare the Map for script parameters
    Map<String, Object> params = new HashMap<>();
      
    params.put("file", "PRIVATE:applications/Errands.ipa");
    params.put("instrument", "noinstrument");
    driver.executeScript("mobile:application:install", params);