PHPackages                             etsy/pigeon-webkit - 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. etsy/pigeon-webkit

ActiveLibrary

etsy/pigeon-webkit
==================

0.1.5(10y ago)48.0k3PHPPHP &gt;=5.3

Since Nov 11Pushed 10y ago2 watchersCompare

[ Source](https://github.com/bertrandmoulard/pigeon-webkit)[ Packagist](https://packagist.org/packages/etsy/pigeon-webkit)[ RSS](/packages/etsy-pigeon-webkit/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (10)Used By (0)

[![pigeon](https://cloud.githubusercontent.com/assets/247901/14675686/34040c90-06d8-11e6-9b64-0829d82ed3a9.png)](https://cloud.githubusercontent.com/assets/247901/14675686/34040c90-06d8-11e6-9b64-0829d82ed3a9.png)
=====================================================================================================================================================================================================================

[](#)

Functional testing tool for PHP built on top of [capybara-webkit](https://github.com/thoughtbot/capybara-webkit)

[![Build Status](https://camo.githubusercontent.com/07485b0f44873844d30b7ad6445b21766855c69514989dffb8e8f6604337791b/68747470733a2f2f7472617669732d63692e6f72672f6265727472616e646d6f756c6172642f706967656f6e2d7765626b69742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bertrandmoulard/pigeon-webkit)

- [Installation](#installation)
- [How it works](#how-it-works)
- [Usage](#usage)

Installation
------------

[](#installation)

The following instructions outline installation using Composer. If you don't have Composer, you can download it from

- Install QT following these \[instructions\] ().
- Install capybara-webkit

```
$ gem install capybara-webkit -v "1.8.0"

```

or

```
$ sudo gem install capybara-webkit -v "1.8.0"

```

- Run the following command:

```
$ php composer.phar global require etsy/pigeon-webkit:dev-master

```

How it works
------------

[](#how-it-works)

capybara-webkit provides a headless web browser (built on QT Webkit). When the browser starts, it opens up a port to accept commands. Pigeon Webkit starts the browser, opens a TCP connection to that port and sends commands to the browser to "drive" it and run assertions.

FunctionalPigeon is extending CapybaraWebkitDriver, which is an implementation of Behat Mink's \[DriverInterface\] (). As a result, most of the methods defined by the interface are available. The ones that are not implemented throw an UnsupportedException.

The css to xpath translation is handled by \[the Symfony CssSelector component\] ([http://symfony.com/doc/current/components/css\_selector.html](http://symfony.com/doc/current/components/css_selector.html))

Usage
-----

[](#usage)

```
$pigeon = new PigeonWebkit\FunctionalPigeon();
$pigeon->visit("https://etsy.com");
print_r($pigeon->body()); // HTML content of etsy.com
$pigeon->click("a#sign-in"); // opens the sign in modal
// ...etc
```

By default, Pigeon Webkit accepts css selectors. But it also has a xpath mode.

```
$pigeon->setXPathMode(true);
$pigeon->visit("https://etsy.com");
$pigeon->click("//a[@id='sign-in']");
```

Example usage with the \[kahlan\] () testing framework

```
