Skip to content

Commit

Permalink
Adding MinkPhantomJSDriver to the documentation via Third party drive…
Browse files Browse the repository at this point in the history
…rs new section
  • Loading branch information
Juan Francisco Calderon Zumba committed Nov 23, 2016
1 parent 7cf6c34 commit cf27aa4
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ALLSPHINXOPTS = -c . -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " livehtml to see the changes done to documentation real time in your local machine"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
Expand Down
4 changes: 2 additions & 2 deletions guides/drivers.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Drivers
=======
Official Drivers
======================

How does Mink provide a consistent API for very different browser library
types, often written in different languages? Through drivers! A Mink driver
Expand Down
11 changes: 11 additions & 0 deletions guides/third-party-drivers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Third party Drivers
======================

Thanks to the ``Behat\Mink\Driver\DriverInterface`` interface, anyone can create a driver.

Drivers that have implemented the mentioned interface and respect the driver test suite:

.. toctree::
:maxdepth: 1

/third-party-drivers/phantomjs.rst
4 changes: 3 additions & 1 deletion index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The recommended way to install Mink with all its dependencies is through

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

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

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

Expand Down
85 changes: 85 additions & 0 deletions third-party-drivers/phantomjs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
PhantomJSDriver
======================

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)`_.

If you want to use a headless browser in your automation tests, with PhantomJSDriver you can.

Installation
------------

PhantomJSDriver is available through Composer:

.. code-block:: bash
$ composer require jcalderonzumba/mink-selenium2-driver
In order to talk with phantomjs, you must install and configure it
first:

1. Download the phantomjs browser from the `project website`_.

2. Install PhantomJSDriver via Composer.

3. Run the browser with the following command:

.. code-block:: bash
$ phantomjs --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /tmp/gastonjs.log &
.. tip::

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.

The testsuite of the driver is still triggering some failures because of bugs in phantomJS or in GastonJS that need to be fixed.

Usage
------------

That's it, now you can use PhantomJSDriver:

.. code-block:: php
$driver = new Zumba\Mink\Driver\PhantomJSDriver('http://localhost:8510');
PhantomJSDriver Feature Support
---------------------------------

====================== =================
Feature PhantomJSDriver
====================== =================
Page traversing Yes
Form manipulation Yes
HTTP Basic auth Yes
Windows management Yes
iFrames management Yes
Request headers access Yes
Response headers Yes
Cookie manipulation Yes
Status code access Yes
Mouse manipulation Yes
Drag'n Drop Yes
Keyboard actions Yes
Element visibility Yes
JS evaluation Yes
Window resizing Yes
Window maximizing No
====================== =================

FAQ
---------

1. Is this a selenium based driver?

**NO**, it has nothing to do with Selenium it's inspired on the `Poltergeist project`_.

2. What features does this driver implements?

**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.

.. _PhantomJS: http://phantomjs.org/
.. _APIs: http://phantomjs.org/api/webpage/
.. _Selenium2 (webdriver): http://seleniumhq.org/
.. _project website: http://phantomjs.org/download.html
.. _GastonJS: http://gastonjs.readthedocs.io/en/latest/
.. _Poltergeist project: https://github.com/teampoltergeist/poltergeist

0 comments on commit cf27aa4

Please sign in to comment.