We love to have your help to make php-webdriver better!
Feel free to open an issue if you run into any problem, or send a pull request (see bellow) with your contribution.
Do not hesitate to ask for a guidance before you implement notable change, or a new feature - use the associated issue or use Discussions. Because any new code means increased effort in library maintenance (which is being done by volunteers in their free time), please understand not every pull request is automatically accepted. This is why we recommend using the mentioned channels to discuss bigger changes in the source code first.
When you are going to contribute, also please keep in mind that this webdriver client aims to be similar to clients in languages Java/Ruby/Python/C#. Here is the official documentation and overview of the official Java API
- Fork the project on GitHub
- Implement your code changes into separate branch
- Make sure all PHPUnit tests passes and code-style matches PSR-2 (see below). We also have CI builds which will automatically run tests on your pull request. Make sure to fix any reported issues reported by these automated tests.
- When implementing a notable change, fix or a new feature, add record to the Unreleased section of CHANGELOG.md
- Submit your pull request against
main
branch
To make sure your code comply with PSR-2 coding style, tests passes and to execute other automated checks, run locally:
composer preinstall # Run this only on the first run - this will install some additional dependencies
composer all
To run functional tests locally there is some additional setup needed - see below. Without this setup, functional tests will be skipped.
For easier development there are also few other prepared commands:
composer fix
- to auto-fix the codestyle and composer.jsoncomposer analyze
- to run only code analysis (without tests)composer test
- to run all tests
There are two test-suites: one with unit tests only (unit
), and second with functional tests (functional
),
which requires running Selenium server and local PHP server.
To execute all tests in both suites run:
composer test
If you want to execute just the unit tests, run:
composer test -- --testsuite unit
Functional tests are run against a real browser. It means they take a bit longer and also require an additional setup:
you must first download and start the Selenium standalone server,
then start the local PHP server which will serve the test pages and then run the functional
test suite:
export BROWSER_NAME="htmlunit" # see below for other browsers
java -jar selenium-server-standalone-X.X.X.jar -log selenium.log &
php -S localhost:8000 -t tests/functional/web/ &
# Use following to run both unit and functional tests
composer all
# Or this to run only functional tests:
composer test -- --testsuite functional
If you want to run tests in different browser then "htmlunit" (Chrome or Firefox), you need to setup the browser driver (Chromedriver/Geckodriver), as it is explained in wiki
and then the BROWSER_NAME
environment variable:
...
export BROWSER_NAME="chrome"
composer all
To test with Firefox/Geckodriver, you must also set GECKODRIVER
environment variable:
export GECKODRIVER=1
export BROWSER_NAME="firefox"
composer all