CAPABILITY GENERATOR

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

Behave with Selenium – Running Behave 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 Behave on LambdaTest Automation.
  2. How to set up an environment for testing your locally hosted websites or web pages.
  3. How to configure Behave 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 Behave With Selenium


  • 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:

  • Download the driver from the link, or you can use pip to install it

  • Make sure you have Behave 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.

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.

Getting Started With Behave & 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 Java 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

Now, we have to create step definition file.

Here is config.cfg file.

Execute The Test


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