You need a working installation of NodeJS and npm. Install the zombie.js library through npm:
npm install -g [email protected]
There are some compatibility issues with newer versions of zombie.js. Some are more or less PHP specific and kinda hard to resolve. If you want to be 100% on the safe side, please use version 0.12.15 or lower.
Versions > 0.12.15 and < 2.0.0 are almost compatible except for some edge cases.
Versions >= 2.0.0-alpha* (or above) are neither compatible nor supported at this point of time due to significant changes of the zombie.js API. As soon as version 2.0 is officially released, we will work on the driver's compatibility.
Use Composer to install all required PHP dependencies:
{
"require": {
"behat/mink": "1.4.*",
"behat/mink-zombie-driver": "1.0.*"
}
}
$> curl http://getcomposer.org/installer | php
$> php composer.phar install
<?php
use Behat\Mink\Mink,
Behat\Mink\Session,
Behat\Mink\Driver\ZombieDriver,
Behat\Mink\Driver\NodeJS\Server\ZombieServer;
$host = '127.0.0.1';
$port = '8124';
$nodeBinary = '/usr/local/bin/node';
$mink = new Mink(array(
'zombie' => new Session(new ZombieDriver(new ZombieServer(
$host, $port, $nodeBinary
))),
));
$mink->setDefaultSessionName('zombie');
$session = $mink->getSession();
$session->visit('http://example.org');
$page = $session->getPage();
$elem = $page->find('css', 'h1');
echo $elem->getText();
Copyright (c) 2011-2012 Pascal Cremer [email protected]
- Pascal Cremer b00gizm