Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
222 changes: 61 additions & 161 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,212 +1,112 @@
# Run Selenium Tests With PHP On LambdaTest
# Run Selenium Tests with PHP on TestMu AI (Formerly LambdaTest)

![image](https://user-images.githubusercontent.com/70570645/171994020-d3c81aca-bd93-4467-a372-ff0283fef8df.png)
<p align="center">
<a href="https://www.lambdatest.com/blog/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium" target="_bank">Blog</a>
&nbsp; &#8901; &nbsp;
<a href="https://www.lambdatest.com/support/docs/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium" target="_bank">Docs</a>
&nbsp; &#8901; &nbsp;
<a href="https://www.lambdatest.com/learning-hub/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium" target="_bank">Learning Hub</a>
&nbsp; &#8901; &nbsp;
<a href="https://www.lambdatest.com/newsletter/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium" target="_bank">Newsletter</a>
&nbsp; &#8901; &nbsp;
<a href="https://www.lambdatest.com/certifications/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium" target="_bank">Certifications</a>
&nbsp; &#8901; &nbsp;
<a href="https://www.youtube.com/c/LambdaTest" target="_bank">YouTube</a>
<a href="https://www.testmuai.com/"><img src="https://img.shields.io/badge/MADE%20BY%20TestMu%20AI-000000.svg?style=for-the-badge&labelColor=000" alt="Made by TestMu AI"></a>
<a href="https://www.php.net/"><img src="https://img.shields.io/badge/PHP-8.x-777BB4.svg?style=for-the-badge&labelColor=000000" alt="PHP version"></a>
<a href="https://community.testmuai.com/"><img src="https://img.shields.io/badge/Join%20the%20community-blueviolet.svg?style=for-the-badge&labelColor=000000" alt="Community"></a>
</p>
&emsp;
&emsp;
&emsp;

*Learn how to run your PHP automation testing scripts on the LambdaTest platform*
## Getting Started

[<img height="58" width="200" src="https://user-images.githubusercontent.com/70570645/171866795-52c11b49-0728-4229-b073-4b704209ddde.png">](https://accounts.lambdatest.com/register?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
[TestMu AI](https://www.testmuai.com/) (Formerly LambdaTest) is the world's first full-stack AI Agentic Quality Engineering platform that empowers teams to test intelligently, smarter, and ship faster. Built for scale, it offers a full-stack testing cloud with 10K+ real devices and 3,000+ browsers. With AI-native test management, MCP servers, and agent-based automation, TestMu AI supports Selenium, Appium, Playwright, and all major frameworks.

With TestMu AI (Formerly LambdaTest), you can run Selenium tests in PHP across real browsers and operating systems. This sample shows how to configure PHP Selenium tests to run on the TestMu AI cloud.

## Table Of Contents
- [Sign up on TestMu AI](https://www.testmuai.com/register/) (Formerly LambdaTest).
- Follow the [TestMu AI Documentation](https://www.testmuai.com/support/docs/) for the full setup walkthrough.

* [Pre-requisites](#pre-requisites)
* [Run Your First Test](#run-your-first-test)
* [Local Testing With PHP](#testing-locally-hosted-or-privately-hosted-projects)
### Prerequisites

## Prerequisites
- PHP 8.x
- Composer
- A TestMu AI (Formerly LambdaTest) account with your username and access key

Before you begin automation testing with Selenium, you would need to:
### Setup

* Make sure that you have the latest **PHP** installed on your system. You can download and install **PHP** using following commands in the terminal:

* **MacOS:** Previous versions of **MacOS** have **PHP** installed by default. But for the latest **MacOS** versions starting with **Monterey**, **PHP** has to be downloaded and installed manually by using below commands:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install php
```
* **Windows:**
```bash
sudo apt-get install curl libcurl3 libcurl3-dev php
```
**Note:** For **Windows**, you can download **PHP** from [here](http://windows.php.net/download/). Also, refer to this [documentation](http://php.net/manual/en/install.windows.php) for ensuring the accessibility of PHP through Command Prompt(cmd).

* Download **composer** in the project directory ([Linux/MacOS](https://getcomposer.org/download/), [Windows](https://getcomposer.org/doc/00-intro.md#installation-windows)).

**Note:** To use the **composer** command directly, it either should have been downloaded in the project directory or should be accessible globally which can be done by the command below:
```bash
mv composer.phar /usr/local/bin/composer
```
### Installing Selenium Dependencies And Tutorial Repo

**Step 1:** Clone the LambdaTest’s Php-Selenium repository and navigate to the code directory as shown below:
Clone and install dependencies:

```bash
git clone https://github.com/LambdaTest/php-selenium-sample
cd Php-Selenium
```
**Step 2:** Install the composer dependencies in the current project directory using the command below:
```bash
git clone https://github.com/LambdaTest/php-selenium-sample && cd php-selenium-sample
composer install
```

### Setting Up Your Authentication

Make sure you have your LambdaTest credentials with you to run test automation scripts on LambdaTest Selenium Grid. You can obtain these credentials from the [LambdaTest Automation Dashboard](https://automation.lambdatest.com/build?utm_source=github&utm_medium=repo&utm_campaign=php-selenium) or through [LambdaTest Profile](https://accounts.lambdatest.com/login?utm_source=github&utm_medium=repo&utm_campaign=php-selenium).

**Step 3:** Set LambdaTest `Username` and `Access Key` in environment variables.
* For **Linux/macOS**:
```bash
export LT_USERNAME="YOUR_USERNAME" export LT_ACCESS_KEY="YOUR ACCESS KEY"
```
* For **Windows**:
```bash
set LT_USERNAME="YOUR_USERNAME" set LT_ACCESS_KEY="YOUR ACCESS KEY"
```

## Run Your First Test

>**Test Scenario**: The sample LambdaTest.php file tests a sample to-do list app by marking couple items as done, adding a new item to the list and finally displaying the count of pending items as output.

Let's check the sample test script [LambdaTest.php](https://github.com/LambdaTest-sample-test-frameworks/Php-Selenium/blob/master/tests/LambdaTest.php) file.

### Configuration Of Your Test Capabilities

**Step 4:** In the test script, you need to update your test capabilities. Here, the code will select the basic capabilities such as OS, browser, browser version and so on.
Set your credentials as environment variables.

```php
//Basic Test Configurations For PHP
**macOS / Linux:**

$capabilities = array(
"build" => "your build name",
"name" => "your test name",
"platform" => "macOS High Sierra",
"browserName" => "Firefox",
"version" => "64.0",
"resolution" => "1280x1024",
"selenium_version" => "3.13.0",
"screenshot" => true,
"firefox.driver" => v0.23.0
)
```bash
export LT_USERNAME="YOUR_USERNAME"
export LT_ACCESS_KEY="YOUR_ACCESS_KEY"
```
You can generate capabilities for your test requirements with the help of our inbuilt [Desired Capability Generator](https://www.lambdatest.com/capabilities-generator/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium).

**Windows:**

### Executing the Test
```bash
set LT_USERNAME="YOUR_USERNAME"
set LT_ACCESS_KEY="YOUR_ACCESS_KEY"
```

**Step 5:** The tests can be executed in the terminal using the following command:
### Run tests

```bash
php Lambdatest.php
```
Your test results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on LambdaTest automation dashboard.

## Testing Locally Hosted Or Privately Hosted Projects

You can test your locally hosted or privately hosted projects with LambdaTest Selenium grid using LambdaTest Tunnel. All you would have to do is set up an SSH tunnel using tunnel and pass toggle `tunnel = True` via desired capabilities. LambdaTest Tunnel establishes a secure SSH protocol based tunnel that allows you in testing your locally hosted or privately hosted pages, even before they are live.
View results on your TestMu AI dashboard.

Refer our [LambdaTest Tunnel documentation](https://www.lambdatest.com/support/docs/testing-locally-hosted-pages/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium) for more information.
### Local testing with TestMu AI Tunnel

Here’s how you can establish LambdaTest Tunnel.
To test locally hosted apps, set up the TestMu AI tunnel. OS-specific guides:

Download the binary file of:
* [LambdaTest Tunnel for Windows](https://downloads.lambdatest.com/tunnel/v3/windows/64bit/LT_Windows.zip)
* [LambdaTest Tunnel for macOS](https://downloads.lambdatest.com/tunnel/v3/mac/64bit/LT_Mac.zip)
* [LambdaTest Tunnel for Linux](https://downloads.lambdatest.com/tunnel/v3/linux/64bit/LT_Linux.zip)
- [Local Testing on Windows](https://www.testmuai.com/support/docs/local-testing-for-windows/)
- [Local Testing on macOS](https://www.testmuai.com/support/docs/local-testing-for-macos/)
- [Local Testing on Linux](https://www.testmuai.com/support/docs/local-testing-for-linux/)

Open command prompt and navigate to the binary folder.
Add the following to your capabilities:

Run the following command:

```bash
LT -user {user’s login email} -key {user’s access key}
```
So if your user name is lambdatest@example.com and key is 123456, the command would be:

```bash
LT -user lambdatest@example.com -key 123456
```
Once you are able to connect **LambdaTest Tunnel** successfully, you would just have to pass on tunnel capabilities in the code shown below :

**Tunnel Capability**

```
"tunnel" => true
```js
tunnel: true,
```

## Tutorials 📙
## Contributions

Check out our latest tutorials on PHP automation testing 👇
Contributions are welcome. Open an issue to discuss your idea before submitting a pull request. When reporting bugs, include your PHP version, OS, and PHP Selenium binding version.

* [10 of the Best PHP Testing Frameworks for 2021](https://www.lambdatest.com/blog/best-php-testing-frameworks-2021/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [Getting Started With Selenium PHP For Automation Testing](https://www.lambdatest.com/blog/selenium-php-tutorial/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [Web automation testing using Selenium PHP on cloud-based Selenium Grid](https://www.lambdatest.com/blog/selenium-php-tutorial/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [Handling Multiple Browser Windows and Tabs in Selenium PHP](https://www.lambdatest.com/blog/handling-windows-in-selenium-with-php/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [How to Work with Tables in Selenium PHP?](https://www.lambdatest.com/blog/tables-in-selenium-php/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [How To Open IE and Edge Browsers In Selenium WebDriver Using PHP](https://www.lambdatest.com/blog/open-ie-and-edge-browser-in-selenium-webdriver-using-php/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [How to Handle Synchronization in Selenium PHP Using Implicit and Explicit Wait?](https://www.lambdatest.com/blog/implicit-explicit-wait-in-selenium/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [How to Execute JavaScript in Selenium PHP?](https://www.lambdatest.com/blog/executing-javascript-in-selenium-php/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [How to Generate PHPUnit Coverage Report in HTML and XML?](https://www.lambdatest.com/blog/phpunit-code-coverage-report-html/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [How to Setup CI/CD Pipeline with Bamboo for PHP Projects?](https://www.lambdatest.com/blog/how-to-setup-cicd-pipeline-with-bamboo-for-php-projects/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
## TestMu AI (Formerly LambdaTest) Community

Connect with testers and developers in the [TestMu AI Community](https://community.testmuai.com/). Ask questions, share what you are building, and discuss best practices in test automation and DevOps.

## TestMu AI (Formerly LambdaTest) Certifications

## Documentation & Resources :books:
Earn free [TestMu AI Certifications](https://www.testmuai.com/certifications/) for testers, developers, and QA engineers. Validate your skills in Selenium, Cypress, Playwright, Appium, Espresso and more. Industry-recognized, shareable on LinkedIn, and built by practitioners, not marketers.


Visit the following links to learn more about LambdaTest's features, setup and tutorials around test automation, mobile app testing, responsive testing, and manual testing.
## Learning Resources by TestMu AI (Formerly LambdaTest)

* [LambdaTest Documentation](https://www.lambdatest.com/support/docs/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [LambdaTest Blog](https://www.lambdatest.com/blog/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
* [LambdaTest Learning Hub](https://www.lambdatest.com/learning-hub/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
Learn modern testing through tutorials, guides, videos, and weekly updates:

## LambdaTest Community :busts_in_silhouette:
* [TestMu AI Blog](https://www.testmuai.com/blog/)
* [TestMu AI Learning Hub](https://www.testmuai.com/learning-hub/)
* [TestMu AI on YouTube](https://www.youtube.com/@TestMuAI)
* [TestMu AI Newsletter](https://www.testmuai.com/newsletter/)

## LambdaTest is Now TestMu AI

The [LambdaTest Community](https://community.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium) allows people to interact with tech enthusiasts. Connect, ask questions, and learn from tech-savvy people. Discuss best practises in web development, testing, and DevOps with professionals from across the globe 🌎
On **January 12, 2026**, [LambdaTest evolved to TestMu AI](https://www.testmuai.com/lambdatest-is-now-testmuai/), the world's first fully autonomous **Agentic AI Quality Engineering Platform**.

## What's New At LambdaTest
Same team. Same infrastructure. Same customer accounts. All existing LambdaTest logins, scripts, capabilities, and integrations continue to work without change.

To stay updated with the latest features and product add-ons, visit [Changelog](https://changelog.lambdatest.com/)

## About LambdaTest
👉 Find the new home for [LambdaTest](https://www.testmuai.com).

[LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium) is a leading test execution and orchestration platform that is fast, reliable, scalable, and secure. It allows users to run both manual and automated testing of web and mobile apps across 3000+ different browsers, operating systems, and real device combinations. Using LambdaTest, businesses can ensure quicker developer feedback and hence achieve faster go to market. Over 500 enterprises and 1 Million + users across 130+ countries rely on LambdaTest for their testing needs.
### How LambdaTest Evolved into TestMu AI

### Features
In 2017, we launched LambdaTest with a simple mission: make testing fast, reliable, and accessible. As LambdaTest grew, we expanded into Test Intelligence, Visual Regression Testing, Accessibility Testing, API Testing, and Performance Testing, covering the full depth of the testing lifecycle.

* Run Selenium, Cypress, Puppeteer, Playwright, and Appium automation tests across 3000+ real desktop and mobile environments.
* Real-time cross browser testing on 3000+ environments.
* Test on Real device cloud
* Blazing fast test automation with HyperExecute
* Accelerate testing, shorten job times and get faster feedback on code changes with Test At Scale.
* Smart Visual Regression Testing on cloud
* 120+ third-party integrations with your favorite tool for CI/CD, Project Management, Codeless Automation, and more.
* Automated Screenshot testing across multiple browsers in a single click.
* Local testing of web and mobile apps.
* Online Accessibility Testing across 3000+ desktop and mobile browsers, browser versions, and operating systems.
* Geolocation testing of web and mobile apps across 53+ countries.
* LT Browser - for responsive testing across 50+ pre-installed mobile, tablets, desktop, and laptop viewports
As software development entered the AI era, testing had to evolve, too. We rebuilt the architecture to be AI-native from the ground up, with autonomous agents that **plan, author, execute, analyze, and optimize tests** while keeping humans in the loop. The platform integrates with your repos, CI, IDEs, and terminals, continuously learning from every code change and development signal.


[<img height="58" width="200" src="https://user-images.githubusercontent.com/70570645/171866795-52c11b49-0728-4229-b073-4b704209ddde.png">](https://accounts.lambdatest.com/register?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
That evolution earned a new name: **TestMu AI**, built for an AI-first future of quality engineering. TestMu is not a new name for us. It is the name of our annual community conference, which has brought together 100,000+ quality engineers to discuss how AI would reshape testing, long before that became an industry norm.

What started as a high-performance cloud testing platform has transformed into an AI-native, multi-agent system powering a connected, end-to-end quality layer. That evolution defined a new identity: LambdaTest evolved into TestMu AI, built for an AI-first future of quality engineering.


## We are here to help you :headphones:
## Support

* Got a query? we are available 24x7 to help. [Contact Us](mailto:support@lambdatest.com)
* For more info, visit - [LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=php-selenium)
Got a question? Email [support@testmuai.com](mailto:support@testmuai.com) or chat with us 24x7 from our chat portal.