LambdaTestAutomation Testing ● Laravel Dusk Selenium: Running Laravel Dusk Testing Scripts on Online Selenium Grid

Laravel Dusk Selenium: Running Laravel Dusk Testing Scripts on Online 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 Laravel Dusk Selenium on LambdaTest.

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

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

Prerequisites to Run Laravel Dusk Testing with Selenium

Before you begin automation testing with Laravel Dusk Selenium, be ready with the below essentials:

  • Make sure that you have the latest PHP build 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).
  • Install Laravel Dusk Framework using the below command with 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.
  • Setting up project dependencies.
  • Check out our GitHub repository for finding all the code references that will be discussed in this topic.

Getting Started With Laravel Dusk Testing on LambdaTest

First, let us create .env from the example file:

Now we need to replace, LT_USERNAME with your LambdaTest username & LT_ACCESS_KEY with your access key. You can acquire both using LambdaTest Dashboard.

After that, you need to update platform configuration in driver method of tests/DuskTestCase.php, to specify the target where tests should run. (List of supported OS platfrom, Browser, resolutions can be found at LambdaTest Capability Generator)Sample configuration.

Running Tests On Locally Hosted Web Pages or Web Apps using Laravel Dusk Selenium

With Lambda Tunnel, you can perform tests on your locally hosted web pages or web apps by a SSH(Secure Shell) connection. All you need to do is specify the tunnel value to true in your desired capabilities. You will find the capabilities in the driver method of tests/DuskTestCase.php


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.

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 Laravel Dusk Testing GitHub Repository for you to clone and play around.

Execute The Laravel Dusk Testing Script

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