From 2b39897ba04bdcf6e52790fd5dc937686ed58817 Mon Sep 17 00:00:00 2001 From: Juan Francisco Calderon Zumba Date: Wed, 23 Nov 2016 18:22:50 +0100 Subject: [PATCH] Adding MinkPhantomJSDriver to the documentation via Third party drivers new section --- Makefile | 1 + guides/drivers.rst | 4 +- guides/third-party-drivers.rst | 11 ++++ index.rst | 4 +- third-party-drivers/phantomjs.rst | 85 +++++++++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 guides/third-party-drivers.rst create mode 100644 third-party-drivers/phantomjs.rst diff --git a/Makefile b/Makefile index 9d2e2e7..7f89d05 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ ALLSPHINXOPTS = -c . -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS help: @echo "Please use \`make ' where 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" diff --git a/guides/drivers.rst b/guides/drivers.rst index 40452c6..c88e693 100644 --- a/guides/drivers.rst +++ b/guides/drivers.rst @@ -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 diff --git a/guides/third-party-drivers.rst b/guides/third-party-drivers.rst new file mode 100644 index 0000000..96892f1 --- /dev/null +++ b/guides/third-party-drivers.rst @@ -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 diff --git a/index.rst b/index.rst index 57b6351..2593898 100644 --- a/index.rst +++ b/index.rst @@ -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. @@ -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 @@ -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 diff --git a/third-party-drivers/phantomjs.rst b/third-party-drivers/phantomjs.rst new file mode 100644 index 0000000..0db88d6 --- /dev/null +++ b/third-party-drivers/phantomjs.rst @@ -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-phantomjs-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