PHPackages                             jeromeerasmus/selenium-automate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jeromeerasmus/selenium-automate

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jeromeerasmus/selenium-automate
===============================

PHP bindings for BrowserStack Local

0.1.2(7y ago)37.4k↓21.4%PHP

Since Jul 28Pushed 7y ago2 watchersCompare

[ Source](https://github.com/JeromeErasmus/browserstack-selenium-behat)[ Packagist](https://packagist.org/packages/jeromeerasmus/selenium-automate)[ RSS](/packages/jeromeerasmus-selenium-automate/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (10)Versions (5)Used By (0)

About this Library
==================

[](#about-this-library)

This library is to assist Selenium and Browserstack Continious Integration with for BeHat testing in native PHP. There are three ways to setup and run the tests:

- **Running Selenium tests locally**
- **Running Selenium tests in Docker (with bitbucket Pipelines)**
- **Running the Browserstack**

The library can be installed into your PHP project using the below composer command which will install the library from Packagist.

```
require jeromeerasmus/selenium-automate:dev-master

```

Running Selenium tests locally
==============================

[](#running-selenium-tests-locally)

### Requirements

[](#requirements)

Requires Firefox v39.0 with Selenium v1.4.0 You can download the correct version of Firefox here: Remember to turn automatic updates off Firefox as soon as it is installed.

### Setup

[](#setup)

First grab the latest JRE and install it on your machine as Selenium runs on the JRE. You first need to install selenium on your machine in order to run the Selenium tests. On OSX this should be as easy as:

```
brew install selenium-server-standalone

```

Next configure your composer.json file with the below commands to be able to run the Selenium tests locally.

```
"scripts": {
    "start-selenium": "vendor/bin/manager start",
    "run-selenium": "vendor/bin/behat --config=conf.selenium.yml -f pretty -o std -f junit -o results"
  }

```

Next, copy dist.conf.selenium.yml and dist.conf.browserstack.yml to conf.selenium.yml and conf.browserstack.yml and then edit them to match your project specifications. You will only need to edit the **base\_url** field for this config.

### Executing the tests

[](#executing-the-tests)

Then perform the below: First start Selenium in a new terminal window. Leave it running.

```
composer start-selenium

```

Then open up a new terminal window and run the sample tests with:

```
composer run-selenium

```

Running Selenium tests in Docker (with bitbucket Pipelines)
===========================================================

[](#running-selenium-tests-in-docker-with-bitbucket-pipelines)

This configuration allows you to run your tests with Docker.

### Requirements

[](#requirements-1)

Docker and Docker Compose installed on your machine. (of course)

### Setup

[](#setup-1)

In the root folder perform the below steps:

1. Create a Dockerfile with the below contents:

    ```
    FROM mycrm/base

    COPY . /var/specs
    WORKDIR /var/specs

    # Config
    ENTRYPOINT ["vendor/bin/behat"]

    ```
2. Create a docker-compose file with the below contents:

    ```
    version: '2'
    services:
      specs:
        build: .
        volumes:
          - .:/var/specs
        container_name: mycrm-specs
        links:
         - firefox-server
        environment:
          BEHAT_PARAMS: '{"extensions" : {"Behat\\MinkExtension" : {"base_url" : "https://it.wikipedia.org/"}}}'

      firefox-server:
        container_name: mycrm-specs-server
        #image: selenium/standalone-firefox-debug:2.53.0
        image: selenium/standalone-firefox:2.53.0
        ports:
          - "4444:4444"
          - "5900:5900"

    ```

Now you can execute the below command which will build the Docker images and run the tests.

```
docker-compose -f docker-compose.yml run --rm specs  --config=conf.selenium-docker.yml

```

### Setup Bitbucket Pipelines script

[](#setup-bitbucket-pipelines-script)

You can run the tests on Bitbucket Pipelines by creating the below bitbucket-pipelines.yml file in your root folder. You can use the below script for the contents.

```
pipelines:
  default:
    - step:
        image: jeromeerasmus/docker-alpine-php-composer:7.0
        services:
          - docker
        script:
          - composer install
          - docker-compose -f docker-compose.yml run --rm specs  --config=conf.selenium-docker.yml

```

Selenium Automate (with Browserstack)
=====================================

[](#selenium-automate-with-browserstack)

[Behat](https://github.com/Behat/Behat) Integration with BrowserStack.

Setup
-----

[](#setup-2)

- Clone the repo into your project root
- Cd into the repo folder on your local machine
- Install dependencies `composer install`
- First copy dist.conf.selenium.yml and dist.conf.browserstack.yml to conf.selenium.yml and conf.browserstack.yml and then edit them to match your project specifications.
- Then copy the dist.env file to .env and update with your browserstack keys

### Creating the capabilities config

[](#creating-the-capabilities-config)

You define a capabilities configuration file to explicity set which browsers / devices / operating systems you will test on. To get the full updated list of capabilities from browserstack run the following command:

```
composer capabilities

```

This will bring down an exhaustive list of ALL capabilities. Look through the list and pick out the capabilities you want to run your tests on. You can use these capabilities to update your .yml files

Once the above is done correctly you will be able to run your tests.

```

## Running the Selenium tests
First grab the latest JRE and install it on your machine as Selenium runs on the JRE. You first need to install selenium on your machine in order to run the Selenium tests. On OSX this should be as easy as:

```

brew install selenium-server-standalone

```

Then perform the below:
First start Selenium

```

composer start-selenium

```

Then run the test

```

composer run-selenium

```

## Running the Browserstack tests
To run a test in browserstack execute

```

composer run-bs

```

### Manufaturing tests by the dozen
The below is some basic workflow tips to save you some time. The below is not essential to running your tests.

Scaffold a BeHat project structure and key files

```

./bin/behat --init

```

After writing your .feature file run the below to create the code snippet and auotmoatically place it into the
Feature context file

```

./bin/behat --append-snippets

```

## Notes
* You can view your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate)
* To test on a different set of browsers, check out  [platform configurator](https://www.browserstack.com/automate/php#setting-os-and-browser)

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

2866d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/781052?v=4)[Jerome Erasmus](/maintainers/Jeromeerasmus)[@JeromeErasmus](https://github.com/JeromeErasmus)

---

Top Contributors

[![JeromeErasmus](https://avatars.githubusercontent.com/u/781052?v=4)](https://github.com/JeromeErasmus "JeromeErasmus (4 commits)")

### Embed Badge

![Health badge](/badges/jeromeerasmus-selenium-automate/health.svg)

```
[![Health](https://phpackages.com/badges/jeromeerasmus-selenium-automate/health.svg)](https://phpackages.com/packages/jeromeerasmus-selenium-automate)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k42](/packages/civicrm-civicrm-core)[oat-sa/tao-core

TAO core extension

66143.7k121](/packages/oat-sa-tao-core)[drupal/drupal-extension

Drupal extension for Behat

22215.7M172](/packages/drupal-drupal-extension)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M570](/packages/shopware-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
