Skip to content

Commit 2b39897

Browse files
author
Juan Francisco Calderon Zumba
committed
Adding MinkPhantomJSDriver to the documentation via Third party drivers new section
1 parent 7cf6c34 commit 2b39897

File tree

5 files changed

+102
-3
lines changed

5 files changed

+102
-3
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ALLSPHINXOPTS = -c . -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS
1717
help:
1818
@echo "Please use \`make <target>' where <target> is one of"
1919
@echo " html to make standalone HTML files"
20+
@echo " livehtml to see the changes done to documentation real time in your local machine"
2021
@echo " dirhtml to make HTML files named index.html in directories"
2122
@echo " singlehtml to make a single large HTML file"
2223
@echo " pickle to make pickle files"

guides/drivers.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Drivers
2-
=======
1+
Official Drivers
2+
======================
33

44
How does Mink provide a consistent API for very different browser library
55
types, often written in different languages? Through drivers! A Mink driver

guides/third-party-drivers.rst

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Third party Drivers
2+
======================
3+
4+
Thanks to the ``Behat\Mink\Driver\DriverInterface`` interface, anyone can create a driver.
5+
6+
Drivers that have implemented the mentioned interface and respect the driver test suite:
7+
8+
.. toctree::
9+
:maxdepth: 1
10+
11+
/third-party-drivers/phantomjs.rst

index.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The recommended way to install Mink with all its dependencies is through
3131

3232
For local installations of composer you must call it like this:
3333
``$ php composer.phar require behat/mink`` .
34-
In this case you must use the different call
34+
In this case you must use the different call
3535
``php composer.phar`` everywhere instead of the simple command ``composer``.
3636

3737
Everything will be installed inside ``vendor`` folder.
@@ -54,6 +54,7 @@ Finally, include Composer autoloading script to your project:
5454
- SeleniumDriver - ``behat/mink-selenium-driver``
5555
- SahiDriver - ``behat/mink-sahi-driver``
5656
- WUnitDriver - ``behat/mink-wunit-driver``
57+
- PhantomJSDriver - ``jcalderonzumba/mink-phantomjs-driver`` (third-party driver)
5758

5859
If you're newcomer or just don't know what to choose, you should probably
5960
start with the GoutteDriver and the Selenium2Driver (you will be able
@@ -73,6 +74,7 @@ Learn Mink with the topical guides:
7374
guides/manipulating-pages
7475
guides/interacting-with-pages
7576
guides/drivers
77+
guides/third-party-drivers
7678
guides/managing-sessions
7779
contributing
7880

third-party-drivers/phantomjs.rst

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
PhantomJSDriver
2+
======================
3+
4+
PhantomJSDriver provides a bridge for the `PhantomJS`_ headless browser, it uses native `APIs`_ to interact with the browser which makes it generally faster than `Selenium2 (webdriver)`_.
5+
6+
If you want to use a headless browser in your automation tests, with PhantomJSDriver you can.
7+
8+
Installation
9+
------------
10+
11+
PhantomJSDriver is available through Composer:
12+
13+
.. code-block:: bash
14+
15+
$ composer require jcalderonzumba/mink-phantomjs-driver
16+
17+
In order to talk with phantomjs, you must install and configure it
18+
first:
19+
20+
1. Download the phantomjs browser from the `project website`_.
21+
22+
2. Install PhantomJSDriver via Composer.
23+
24+
3. Run the browser with the following command:
25+
26+
.. code-block:: bash
27+
28+
$ phantomjs --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /tmp/gastonjs.log &
29+
30+
.. tip::
31+
32+
The PhantomJSDriver relies on the `GastonJS`_ project to talk to phantomjs, this means you can do more things that are outside of the scope of the Mink Driver interface.
33+
34+
The testsuite of the driver is still triggering some failures because of bugs in phantomJS or in GastonJS that need to be fixed.
35+
36+
Usage
37+
------------
38+
39+
That's it, now you can use PhantomJSDriver:
40+
41+
.. code-block:: php
42+
43+
$driver = new Zumba\Mink\Driver\PhantomJSDriver('http://localhost:8510');
44+
45+
PhantomJSDriver Feature Support
46+
---------------------------------
47+
48+
====================== =================
49+
Feature PhantomJSDriver
50+
====================== =================
51+
Page traversing Yes
52+
Form manipulation Yes
53+
HTTP Basic auth Yes
54+
Windows management Yes
55+
iFrames management Yes
56+
Request headers access Yes
57+
Response headers Yes
58+
Cookie manipulation Yes
59+
Status code access Yes
60+
Mouse manipulation Yes
61+
Drag'n Drop Yes
62+
Keyboard actions Yes
63+
Element visibility Yes
64+
JS evaluation Yes
65+
Window resizing Yes
66+
Window maximizing No
67+
====================== =================
68+
69+
FAQ
70+
---------
71+
72+
1. Is this a selenium based driver?
73+
74+
**NO**, it has nothing to do with Selenium it's inspired on the `Poltergeist project`_.
75+
76+
2. What features does this driver implements?
77+
78+
**ALL** of the features defined in Mink DriverInterface. maximizeWindow is the only one not implemented since is a headless browser it does not make sense to implement it.
79+
80+
.. _PhantomJS: http://phantomjs.org/
81+
.. _APIs: http://phantomjs.org/api/webpage/
82+
.. _Selenium2 (webdriver): http://seleniumhq.org/
83+
.. _project website: http://phantomjs.org/download.html
84+
.. _GastonJS: http://gastonjs.readthedocs.io/en/latest/
85+
.. _Poltergeist project: https://github.com/teampoltergeist/poltergeist

0 commit comments

Comments
 (0)