Skip to content

Commit

Permalink
add a chapter about creating new steps
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandresalome committed Jan 22, 2014
1 parent e49c6cb commit cb2503f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions doc/behat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,24 @@ Available steps
| xpath=//input | foobar |
| A select field | The option label |
Create new browser steps
------------------------

If you need to manipulate Browser object, create a context class extending ``AbstractWebDriverContext`` class and implement your business:

.. code-block:: php
use WebDriver\Behat\AbstractWebDriverContext;
class MyContext extends AbstractWebDriverContext
{
/** @Then /^I should see a unicorn */
public function iShouldSeeAUnicorn()
{
$browser = $this->getBrowser();
// now, you have a WebDriver\Browser instance
}
}
Take a look at the `abstract class <https://github.com/alexandresalome/php-webdriver/blob/master/src/WebDriver/Behat/AbstractWebDriverContext.php>`_ to see facilities provided to you.

0 comments on commit cb2503f

Please sign in to comment.