CAPABILITY GENERATOR

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

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


Execute your automation test scripts with Selenium WebDriver instantly through LambdaTest which is a cloud-based, cross browser testing tool offering a Selenium grid consisting 2000+ browsers and browser versions running on real operating systems to pace up automation testing of your web-app or website. In this topic, you will learn how to automate your website testing using Selenium with Behat on LambdaTest.

By the end of this topic, you will be able to:

  1. Run a sample Selenium with Behat on LambdaTest Automation.
  2. Set up an environment for testing your locally hosted web pages.
  3. Understand & configure Behat desired capabilities for executing a Selenium test.
  4. Explore advanced features of LambdaTest.

Prerequisites For Running Behat and Selenium


Before you begin automation testing with Selenium and Behat, be ready with the below essentials:

  • Make sure that you have the latest PHP installed on your system. If you are using a Mac then PHP would be installed by default. For Linux you would need to enter the below command in terminal:
  • For Windows, you can download PHP from here. Also, refer to this documentation for ensuring the accessibility of PHP through Command Prompt(cmd).

  • Set up Behat for your OS using composer.
  • If you don’t have composer installed in your system then click here.

  • Once you have composer installed, you can leverage Composer to download and install Selenium dependencies. For that first create a composer.json file in your directory and add the following code to the json.
  • Check out our GitHub repository for finding all the code references that will be discussed in this topic.

Getting Started With Behat and LambdaTest


Let us have a look at an example which will validate your LambdaTest credentials for authentication purpose. Later, the code will select the basic capabilities such as OS, browser, browser version and so on. This code is also available on our Behat GitHub repository for you to clone and play around.

Execute The Test


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