Skip to main content
Introducing the Automate SDK! Get your entire test suite running on BrowserStack in minutes! Learn More.
No Result Found

Selenium with PHP

Your guide to running tests using PHP on BrowserStack’s Selenium Grid of 3000+ real devices and desktop browsers.

Run tests on 3000+ real devices and desktop browsers

Prerequisites

  • BrowserStack Username and Access key. You can find this in your account summary section. If you do not have an account yet, sign up for a Free Trial.
  • Composer should be installed

Run a sample build

Here’s how you can run a sample PHP test build in three steps on BrowserStack:

Get Sample Project

Get our sample project using one of the following options:

Option 1: Download Project

Download ZIP

Option 2: Using Git

Clone our sample Git repository using the commands.

Copy icon Copy

Configure the test script

In order to test, you will need to configure a few parameters in the sample repository.

Set access credentials

Set userName and accessKey parameters in the phpunit-browserstack/config/test.conf.json file to authenticate your tests on BrowserStack.

Configure browser or device combinations

Choose from 3000+ real mobile devices and browsers available on BrowserStack:

Parallel thread #1
Parallel thread #2
Parallel thread #3

Copy and replace the test.conf.js config file

Copy the adjacent config and paste it in the phpunit-browserstack/conf/test.conf.js file within your project folder.

Copy icon Copy

Execute build on BrowserStack

You are now ready to run your build on BrowserStack. From the root directory of this project, run the following command.

Copy icon Copy

If the test fails, set BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY as environment variables on your computer and try again.

Next steps

After you have successfully run your first test on BrowserStack, try integrating your test suite with BrowserStack

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle