Skip to main content

Trigger Your Job via Local Selenium Web Driver

As a tester, whenever you switch from local web driver to remote web driver can be a tedious and time-consuming process. You will have to manually modify your tests which includes adding Desired Capabilities, and adjusting code just to get them running on a cloud testing platform.

HyperExecute's support for Local Selenium Driver allows you to seamlessly run your tests on our platform with very minimal changes. It will help you in

  • Reduce Onboarding Time : You can skip the manual code changes and configuration associated with remote web drivers, and accelerate your integration with HyperExecute.
  • Minimal Code Refactoring : You can now maintain your existing test code, without worrying about the need for significant modifications.
  • Seamless Platform Transitions : You can run both web and mobile tests (using Selenium and Appium) without platform-specific changes.

How to Trigger Your Tests?​

To utilize the native Selenium driver support in HyperExecute, you need to incorporate the following steps into your testing workflow:

Step 1: Configure Your Test Suite​

You can use your own project to configure and test it. For demo purposes, we are using the sample repository.

Sample repo

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

Image View on GitHub

Step 2: Update YAML Configuration:​

  • Add the platformConfig flag to your YAML file, specifying the platforms and configurations for your tests.
  • Use the platform flag to define individual platform configurations (OS, browser/device, capabilities).
  • (Optional) Utilize the config flag to set global capabilities applicable to all platforms.
---
version: 0.1
globalTimeout: 150
testSuiteTimeout: 150
testSuiteStep: 150

runson: win

autosplit: true

retryOnFailure: true
maxRetries: 1

parallelism: 1
concurrency: 1

env:
CACHE_DIR: m2_cache_dir

cacheKey: '{{ checksum "pom.xml" }}'
cacheDirectories:
- m2_cache

pre:
- mvn dependency:resolve

mergeArtifacts: true
uploadArtefacts:
- name: ExecutionSnapshots
path:
- target/surefire-reports/html/**

report: true
partialReports:
location: target/surefire-reports/html
type: html
frameworkName: extent

testDiscovery:
type: raw
mode: dynamic
command: grep 'test name' xml/testng.xml | awk '{print$2}' | sed 's/name=//g' | sed 's/\x3e//g'

testRunnerCommand: mvn test dependency:resolve
winTestRunnerCommand: mvn test dependency:resolve
macTestRunnerCommand: mvn test dependency:resolve
linuxTestRunnerCommand: mvn test dependency:resolve

platformConfig:
platform:
- os: win10
browserName: chrome
browserVersion: latest
build: win10
network: false
- os: win11
browserName: chrome
goog:chromeOptions:
args: [ "--start-maximized", "--disable-gpu" ]
- os: mac
browserName: firefox
browserVersion: 119
- os: linux
browserName: firefox
browserVersion: 115
- os: android
deviceName: .*
browserName: chrome
- os: ios
deviceName: .*

config:
build: latest
network: true
console: true
info
  • For operating system win, mac, and linux, only the os flag is mandatory, rest are optional.
  • For operating system android and ios, the os and deviceName flags are mandatory, rest are optional.

In the above sample YAML file, we have passed parallelism = 1 and total number of platforms = 6

The number of tasks created = (total number of platforms) * (parallelism) = 6 tasks

  • 1 windows 10 with Chrome Browser
  • 1 windows 11 with Chrome browser
  • 1 mac with Firefox browser
  • 1 android with any device (we have not specified device name)
  • 1 ios with any device (we have not specified device name)
Image

You can generate capabilities for your test requirements with the help of our inbuilt πŸ”— Capabilities Generator Tool.

Step 3: Run Your Tests:​

  • Execute your tests as usual through your test framework (e.g., JUnit, TestNG).
  • HyperExecute automatically intercepts Selenium commands and routes them to its platform.
./hyperexecute --user <your_username> --key <your_access_key> --config <your_yaml_file_name>
Image

Priority Mapping of Capability Selection​

HyperExecute follows a specific priority order when selecting capabilities. The capabilities added in the config flag are global and applicable to all the platforms.

So in the above example, network:true capability is applied to all the platform configurations but in the case of platform win10-chrome network capabilities will be set as false.

Script ConfigYAML configYAML platformFinal Status
"console": info"console": debug"console": warning"console": warning
"console": info"console": debugNA"console": debug
"console": debugNA"console": debug"console": debug
NA"console": debug"console": warning"console": warning

Considerations and Constraints​

While HyperExecute's native Selenium driver support offers significant advantages, it's essential to note the following constraints:

  • If you are using IEDriver in your scripts, the tests won’t be run on any platform beside Windows 10
  • Currently SafariDriver is not compatible with the following feature.
  • Scripts with hardcoded paths for Selenium drivers may require minor adjustments.
  • Support for AndroidDriver is not yet available; however, Chromedriver can be used for Appium testing.