Chris@0
|
1 Mink
|
Chris@0
|
2 ====
|
Chris@0
|
3 [](https://packagist.org/packages/behat/mink)
|
Chris@0
|
4 [](https://packagist.org/packages/behat/mink)
|
Chris@0
|
5 [](https://packagist.org/packages/behat/mink)
|
Chris@0
|
6 [](https://scrutinizer-ci.com/g/minkphp/Mink/?branch=master)
|
Chris@0
|
7 [](https://scrutinizer-ci.com/g/minkphp/Mink/)
|
Chris@0
|
8 [](https://travis-ci.org/minkphp/Mink)
|
Chris@0
|
9 [](https://insight.sensiolabs.com/projects/5bb8fab0-978f-428a-ae23-44ee4e129fbc)
|
Chris@0
|
10 [](https://packagist.org/packages/behat/mink)
|
Chris@0
|
11
|
Chris@0
|
12
|
Chris@0
|
13 Useful Links
|
Chris@0
|
14 ------------
|
Chris@0
|
15
|
Chris@0
|
16 - The main website with documentation is at [http://mink.behat.org](http://mink.behat.org)
|
Chris@0
|
17 - Official Google Group is at [http://groups.google.com/group/behat](http://groups.google.com/group/behat)
|
Chris@0
|
18 - IRC channel on [#freenode](http://freenode.net/) is `#behat`
|
Chris@0
|
19 - [Note on Patches/Pull Requests](CONTRIBUTING.md)
|
Chris@0
|
20
|
Chris@0
|
21 Usage Example
|
Chris@0
|
22 -------------
|
Chris@0
|
23
|
Chris@0
|
24 ``` php
|
Chris@0
|
25 <?php
|
Chris@0
|
26
|
Chris@0
|
27 use Behat\Mink\Mink,
|
Chris@0
|
28 Behat\Mink\Session,
|
Chris@0
|
29 Behat\Mink\Driver\GoutteDriver,
|
Chris@0
|
30 Behat\Mink\Driver\Goutte\Client as GoutteClient;
|
Chris@0
|
31
|
Chris@0
|
32 $startUrl = 'http://example.com';
|
Chris@0
|
33
|
Chris@0
|
34 // init Mink and register sessions
|
Chris@0
|
35 $mink = new Mink(array(
|
Chris@0
|
36 'goutte1' => new Session(new GoutteDriver(new GoutteClient())),
|
Chris@0
|
37 'goutte2' => new Session(new GoutteDriver(new GoutteClient())),
|
Chris@0
|
38 'custom' => new Session(new MyCustomDriver($startUrl))
|
Chris@0
|
39 ));
|
Chris@0
|
40
|
Chris@0
|
41 // set the default session name
|
Chris@0
|
42 $mink->setDefaultSessionName('goutte2');
|
Chris@0
|
43
|
Chris@0
|
44 // visit a page
|
Chris@0
|
45 $mink->getSession()->visit($startUrl);
|
Chris@0
|
46
|
Chris@0
|
47 // call to getSession() without argument will always return a default session if has one (goutte2 here)
|
Chris@0
|
48 $mink->getSession()->getPage()->findLink('Downloads')->click();
|
Chris@0
|
49 echo $mink->getSession()->getPage()->getContent();
|
Chris@0
|
50
|
Chris@0
|
51 // call to getSession() with argument will return session by its name
|
Chris@0
|
52 $mink->getSession('custom')->getPage()->findLink('Downloads')->click();
|
Chris@0
|
53 echo $mink->getSession('custom')->getPage()->getContent();
|
Chris@0
|
54
|
Chris@0
|
55 // this all is done to make possible mixing sessions
|
Chris@0
|
56 $mink->getSession('goutte1')->getPage()->findLink('Chat')->click();
|
Chris@0
|
57 $mink->getSession('goutte2')->getPage()->findLink('Chat')->click();
|
Chris@0
|
58 ```
|
Chris@0
|
59
|
Chris@0
|
60 Install Dependencies
|
Chris@0
|
61 --------------------
|
Chris@0
|
62
|
Chris@0
|
63 ``` bash
|
Chris@0
|
64 $> curl -sS https://getcomposer.org/installer | php
|
Chris@0
|
65 $> php composer.phar install
|
Chris@0
|
66 ```
|
Chris@0
|
67
|
Chris@0
|
68 Contributors
|
Chris@0
|
69 ------------
|
Chris@0
|
70
|
Chris@0
|
71 * Konstantin Kudryashov [everzet](https://github.com/everzet) [lead developer]
|
Chris@0
|
72 * Christophe Coevoet [stof](https://github.com/stof) [lead developer]
|
Chris@0
|
73 * Alexander Obuhovich [aik099](https://github.com/aik099) [lead developer]
|
Chris@0
|
74 * Other [awesome developers](https://github.com/minkphp/Mink/graphs/contributors)
|