Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
PHP 5.3+ web browser emulator abstraction
PHP

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
features
src/Behat/Mink
tests
vendor
.gitignore
.gitmodules
CHANGES.md
LICENSE
README.md
autoload.php
behat.yml
package.xml.tpl
phpunit.xml.dist

README.md

Behat\Mink

Usage

<?php

use Behat\Mink\Mink,
    Behat\Mink\Driver\GoutteDriver,
    Behat\Mink\Driver\SahiDriver;

$startUrl = 'http://example.com';

// init Mink and register drivers
$mink = new Mink();
$mink->registerDriver('goutte',     new GoutteDriver($startUrl), true);  // last argument === isDefault
$mink->registerDriver('javascript', new SahiDriver($startUrl, 'firefox'));
$mink->registerDriver('symfony2',   new GoutteDriver($startUrl, $container->get('client')));
$mink->registerDriver('custom',     new MyCustomDriver($startUrl));

// run in default driver ("goutte" is default driver - last argument to registerDriver())
$mink->switchToDefaultDriver();
$mink->getSession()->getPage()->findLink('Downloads')->click();
echo $mink->getSession()->getPage()->getContent();

// run in javascript (Sahi) driver
$mink->switchToDriver('javascript');
$mink->getSession()->getPage()->findLink('Downloads')->click();
echo $mink->getSession()->getPage()->getContent();

// run in custom driver
$mink->switchToDriver('custom');
$mink->getSession()->getPage()->findLink('Downloads')->click();
echo $mink->getSession()->getPage()->getContent();

Copyright

Copyright (c) 2011 Konstantin Kudryashov (ever.zet). See LICENSE for details.

Contributors

  • Konstantin Kudryashov everzet [lead developer]

Sponsors

Something went wrong with that request. Please try again.