Selenium with PHPUnit
Requirements
- Java JDK
- PHP
- PHPUnit
WebDriver
- Install
Download And Install Selenium Standalone Server
http://docs.seleniumhq.org/download/
- Start
java -jar selenium-server-standalone-2.52.0.jar
Facebook PHP Web Driver
php composer.phar require facebook/webdriver
Integrate with PHPUnit
<?php
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;
class RegitsterTest extends PHPUnit_Framework_TestCase
{
protected $webDriver;
public function setUp()
{
$this->webDriver = RemoteWebDriver::create('http://localhost:4444/wd/hub', DesiredCapabilities::firefox());
}
public function tearDown()
{
$this->webDriver->quit();
}
}
Example
https://github.com/dinos80152/php-tutorial/selenium
Tutorial
- Facebook PHP WebDriver Example(Only WebDriver)
- Using the Selenium Web Driver API with PHPUnit@sitepoint
- Working with PHPUnit and Selenium Webdriver@codeception
Documentation
http://facebook.github.io/php-webdriver/