Skip to main content

Running Playwright Real Device Tests on HyperExecute

This guide explains how to run your Playwright tests on Real devices (Android and iOS) using HyperExecute:

Prerequisites

Before running your tests, ensure you have:

Step 1: Set Up Your Test Project

You can use your own Playwright project or try the sample repo:. For demo purposes, we are using the sample repository.

Sample repo

Download or Clone the code sample for the Playwright Real Device from the LambdaTest GitHub repository to run the tests on the HyperExecute.

Image View on GitHub

Configure Desired Capabilities

Update your test configuration with the required capabilities.

playwright-android-real-device.js
loading...

You can also use dev and beta browser versions. To generate capabilities for your test requirements, you can use our inbuilt 🔗 Capabilities Generator Tool.

Configure the CDP URL

You will have to update the CDP (Chrome DevTools Protocol) URL which is a protocol used for communication between the browser and the developer tools.

playwright-ios-real-device.js
const browser = await chromium.connect({
wsEndpoint: `wss://cdp.lambdatest.com/playwright?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
})

Step 2: Download the CLI in your Project

The CLI is used for triggering the tests on HyperExecute. It is recommend to download the CLI binary on the host system and keep it in the root directory of the project to execute the tests on HyperExecute.

You can download the CLI for your desired platform from the below mentioned links:

Host MachineHyperExecute CLI
Windowshttps://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe
MacOShttps://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute
Linuxhttps://downloads.lambdatest.com/hyperexecute/linux/hyperexecute

Step 3: Configure YAML in your Test Suite

Use the sample YAML below to configure your execution:

hyperexecute_android.yaml
loading...
info

To Run test on Mobile Containers in a Particular Region

hyperexecute.yaml
dynamicAllocation: true

framework:
name: appium
args:
playwrightRD : true
region: ap # supported regions -> ap, eu, us
reservation: false
  • If reservation : false, it means that it will allocate the device from any region. If you want to allocate the device of any specific region, keep the reservation : true.

Step 4: Execute your Test Suite

NOTE : In case of MacOS, if you get a permission denied warning while executing CLI, simply run chmod u+x ./hyperexecute to allow permission. In case you get a security popup, allow it from your System PreferencesSecurity & PrivacyGeneral tab.

Run the below command in your terminal at the root folder of the project:

./hyperexecute --user undefined --key undefined --config RELATIVE_PATH_OF_YOUR_YAML_FILE 

Step 5: Monitor the Test Execution

Visit the HyperExecute Dashboard and check your Job status.

automation-dashboard

Step 6: Download Artifacts and Reports

HyperExecute also facilitates the provision to download the Artifacts and Reports on your local machine. Click on the corresponding button to download your generated artifacts and reports.

automation-dashboard

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles