CAPABILITY GENERATOR

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

Robot with Selenium – Running Robot 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 Java 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 Java based automation test scripts on LambdaTest Selenium cloud platform. In this post we would be exploring:

  1. How to run a sample Selenium with Robot on LambdaTest Automation.
  2. How to set up an environment for testing your locally hosted websites or web pages.
  3. How to configure Robot desired capabilities for executing a Selenium test.
  4. How to run your test cases in parallel to reduce build times
  5. Advanced features of LambdaTest.

Prerequisites For Running Robot With Selenium


  1. Global Dependencies
    • Have Selenium WebDriver client driver installed inside your local Python environment.
    • Make sure that you have the latest Python build installed. You can download the latest Python build from https://www.python.org/downloads/.
    • You would need Python package manager, pip, as well. Usually latest python installers come prepacked with pip. However if you don’t have pip, you can install it using command:
    • Install Python with Homebrew
    • Download the driver from the link, or you can use pip to install it.
    • Make sure you have Robot installed in your system. In case you don’t! Enter the below command:
    • If you wish to test locally hosted or privately hosted projects, you would also need Lambda Tunnel binary file.
  2. LambdaTest Authentication Credentials
    • You would need to your LambdaTest authentication credentials(Access key & Username). You need to update these credentials in the /Resources/Common.robot file.

  3. Project Dependencies
    • Install necessary packages (use sudo if necessary)

Getting Started With Robot & LambdaTest


The first step in using LambdaTest platform is to understand LambdaTest’s Selenium Grid capabilities. Our Selenium Grid uses remote webdriver instead of normal Selenium client browser drivers so if you are migrating from locally run Selenium, you would have to invoke LambdaTest Selenium remote webdriver. Next you need to specify in your code, which browser, browser versions, operating systems, and resolution you wish to run your test on, along with defining LambdaTest specific capabilities. You can checkout LambdaTest Capabilities Generator tool to understand more about how you can define running browser environments and leverage advanced LambdaTest capabilities.

Let’ start with a simple Selenium Remote Webdriver test first. The Robot script below tests a simple to-do application with basic functionalities like mark items as done, add items in list, calculate total pending items etc. You can also find this at our GitHub repository.

Feature: Test to add item Scenario: Test sample-todo-app Given I go to sample-todo-app to add item Then I Click on first checkbox and second checkbox When I enter item to add When I click add button Then I should verify the added item

Now, we have to create step definition file.

Here is common.robot file to setup mandatory details to run at LambdaTest.

Execute The Test


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

Testing Locally Hosted or Privately Hosted Projects


To help you perform cross browser testing of your locally stored web pages, LambdaTest provides an SSH(Secure Shell) tunnel connection with the name Lambda Tunnel. With Lambda Tunnel, you can test your locally hosted files before you make them live over the internet. You could even perform cross browser testing from different IP addresses belonging to various geographic locations. You can also use LambdaTest Tunnel to test web-apps and websites that are permissible inside your corporate firewall. The SSH tunnel provided by LambdaTest acts as a proxy server for hosting your web pages from your local machine to Virtual machines running on LambdaTest cloud servers. Curious to know more about Lambda Tunnel?

Follow our documentation on Lambda Tunnel to know it all. OS specific instructions to download and setup tunnel binary can be found at the following links.

You can start tunnel by executing the below command in your cmd(Command Prompt) / terminal. Make sure that your pointer is routed in the same directory where you extract the downloaded Lambda Tunnel zip file.

So for example, if your user login email is example@lambdatest.com and your user key is 123asd123, then the command would be:

Parallel Testing


Parallel Testing is one of the most demanding feature of LambdaTest Selenium Grid. By parallel testing, you can run more than one test case, simultaneously. This means that, Parallel testing would allow you to execute numerous automation test cases altogether. So you execute a single test scenario across different browsers or could run different test scenarios across the same browser but with different browser versions.

To perform parallel testing on LambdaTest Selenium grid use the below command.