Mink

PHP 5.3+ web browser emulator abstraction

Github stars Tracking Chart

Mink

Latest Stable Version
Latest Unstable Version
Total Downloads
Scrutinizer Code Quality
Code Coverage
Build Status
SensioLabsInsight
License

Usage Example

<?php

use Behat\Mink\Mink,
    Behat\Mink\Session,
    Behat\Mink\Driver\GoutteDriver,
    Behat\Mink\Driver\Goutte\Client as GoutteClient;

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

// init Mink and register sessions
$mink = new Mink(array(
    'goutte1' => new Session(new GoutteDriver(new GoutteClient())),
    'goutte2' => new Session(new GoutteDriver(new GoutteClient())),
    'custom'  => new Session(new MyCustomDriver($startUrl))
));

// set the default session name
$mink->setDefaultSessionName('goutte2');

// visit a page
$mink->getSession()->visit($startUrl);

// call to getSession() without argument will always return a default session if has one (goutte2 here)
$mink->getSession()->getPage()->findLink('Downloads')->click();
echo $mink->getSession()->getPage()->getContent();

// call to getSession() with argument will return session by its name
$mink->getSession('custom')->getPage()->findLink('Downloads')->click();
echo $mink->getSession('custom')->getPage()->getContent();

// this all is done to make possible mixing sessions
$mink->getSession('goutte1')->getPage()->findLink('Chat')->click();
$mink->getSession('goutte2')->getPage()->findLink('Chat')->click();

Install Dependencies

$> curl -sS https://getcomposer.org/installer, php
$> php composer.phar install

Contributors

Main metrics

Overview
Name With Ownerminkphp/Mink
Primary LanguagePHP
Program languagePHP (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2011-04-04 16:11:16
Pushed At2025-02-07 09:31:36
Last Commit At2025-02-07 10:31:36
Release Count44
Last Release Namev1.12.0 (Posted on )
First Release Namev0.1.0 (Posted on 2011-04-04 19:25:45)
用户参与
Stargazers Count1.6k
Watchers Count38
Fork Count280
Commits Count1.4k
Has Issues Enabled
Issues Count402
Issue Open Count54
Pull Requests Count293
Pull Requests Open Count22
Pull Requests Close Count153
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private