LambdaTest DocumentationAutomation Testing ● WD with Selenium – Running WD Automation Scripts on LambdaTest Selenium Grid

WD with Selenium – Running WD Automation Scripts on LambdaTest Selenium Grid

LambdaTest Selenium Automation Grid is a cloud based scalable Selenium testing platform which enables you to run your automation scripts on 2000+ different browsers and operating systems. You can now run your JavaScript Selenium automated test cases on a scalable Selenium infrastructure that is running real browsers and real operating systems.

This post will help you in getting started with configuring and running your JavaScript based automation test scripts on LambdaTest Selenium cloud platform using WD. This topic will help you to:

  • Run a sample Selenium Webdriver test using JavaScript on LambdaTest Automation.

  • To comprehend and configure Selenium test suite with respect to your capabilities.

  • Selecting the specific browsers to run your test on.

  • Explore advanced features of LambdaTest.

  • To run your test cases in parallel to reduce build times.

  • To test your locally hosted pages.

Prerequisites For Running WD and Selenium

Before getting started with Automated Scripts using Selenium with WD on LambdaTest Automation, you need to:

  • The first step is to download and install node.js and node package manager or npm. You should be having nodejs v6 or newer. Click here to download.
  • Make sure to use the latest version of JavaScript.
  • TMake sure you have WD installed in your system, you can install it using the below command through npm:
  • Install WD through npm using the below command.

  • Download Selenium JavaScript bindings from the official Selenium website.
  • Once you download the JavaScript bindings, extract the ZIP file which you’ve downloaded. After extracting the file, you need to add Selenium Java bindings which is a JAR file and all the dependent libraries to your classpath.

Installing Selenium Dependencies For Node.js

Next step is to install Selenium dependencies for Node.js using npm. Here’s the command to run:

  • Download Lambda Tunnel binary file if you wish to test your locally hosted or privately hosted projects.

Getting Started With WD and LambdaTest

Running WD test scripts on LambdaTest Selenium grid is as easy as changing a few lines of code. To start with, you would have to invoke Selenium remote webdriver instead of local browser webdriver. In addition, since we are using remote webdriver, we have to define which browser environment we want to run the test. We do that by passing browser environment details to LambdaTest Selenium grid via desired capabilities class. You can use LambdaTest Capabilities Generator to select & pass those browser environment specifications.

Let’s checkout sample WD code running LambdaTest Selenium grid. This is a simple WD automation script that test a sample to-do list app. The code marks two list items as done, add a list item and then finally give the total number of pending items as output.

You can also find this code at our GitHub repository for WD.

Below is the export.config file where we will be declaring the desired capabilities.

Now, let’s create lambdatest.js.

Now, finally create package.json file.

The Selenium Webdriver test would open a URL, mark the first two items in the list as done, add an item in the list, and return the total number of pending item. Your results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on LambdaTest dashboard. LambdaTest Dashboard will help you view all your text logs, screenshots and video recording for your entire Selenium tests.

Execute The Test

Running A Single Test

You would need to execute the below command in your terminal/cmd.

Running Multiple Tests In Parallel

Parallel Testing is one of the most demanding features of LambdaTest Selenium Grid. By parallel testing, you can run more than one test case, simultaneously. So you can execute a single test scenario across different browsers or could run different test scenarios across the same browser but with different browser versions. Wondering how many parallel test cases can you run? That depends entirely on the number of concurrent session under your opted plan.

Run the below command for parallel testing.

Parallel Testing Sample Code


To prevent over-exploitation of the platform we have added a capacity constraint on the number of tests that can be queued at our platform. Your maximum queue capacity will be dependent upon the number of concurrent sessions your LambdaTest account is eligible for. Below formula will help you calculate the maximum capacity for your queue.

Maximum Queuing Capacity

Maximum number of parallel tests that can be queued = n + 150

Here, n = number of concurrent sessions.

For example, if you have opted for pricing where you can avail up to 10 concurrent sessions. Then the maximum number of parallel test cases that can be queued will be equal to 10 + 150 i.e. 160 parallel test cases. Queuing allows you to manage your test pipeline in a hassle-free manner. LambdaTest would automatically schedule and execute test cases for you.

LambdaTest Queuing Policy

Here you can get more information about LambdaTest Queuing Policy.

Queuing Timeout

There is also a limit on how long a test case can stay in the queue. If your test case stays in the queue for more than 15 minutes, the test case would be timed out and would not be executed.