xi-project / xi-test-selenium

Selenium WebDriver wrapper

Home Page:http://xi-project.github.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xi-test-selenium

This is a PHP 5.3 wrapper around Selenium 2 WebDriver Server via the wire protocol.

It is useful, reasonably well-tested, cleanly built and extensible. Although it does not wrap everything yet, it can be used right now and trivially subclassed to meet any additional requirements (although a fork and a pull request would also be appreciated).

The library is quite easy to use with any test framework, but there is an inherit-and-go base class for PHPUnit.

Mini-Tutorial

Download the latest selenium-server-standalone jar and leave it running with java -jar path/to/the.jar.

Usage:

<?php
use \Xi\Test\Selenium\SeleniumServer,
    \Xi\Test\Selenium\WebDriver;

// An autoloader with the proper search paths is assumed

$server = new SeleniumServer('http://localhost:4444/wd/hub');
$browser = new WebDriver($server);
$browser->visit('/index');
$browser->findByLabel('Username')->fillIn('john');
$browser->findByLabel('Password')->fillIn('shepard');
$browser->find('form#login button[type=submit]')->click();
$browser->waitForText('Welcome john');
$browser->screenshot('after-login.png');

API documentation is available.

With PHPUnit, just extend \Xi\Test\Selenium\PHPUnit\WebDriverTestCase and use $this->browser.

These scripts may be useful:

Competitors

The following libraries aim to do what we do.

About

Selenium WebDriver wrapper

http://xi-project.github.com/

License:Other


Languages

Language:PHP 97.5%Language:Shell 2.5%