I am attempting to execute the behat/selenium test with Chrome browser by running the following feature scenario. I would like to keep the browser window open instead of closing the Chrome immediately. Even though I have implemented the iWaitForSeconds step definition, I am still encountering errors. Below is the code snippet, can you please assist in identifying what went wrong? Thank you very much!
2 scenarios (2 undefined)
10 steps (8 passed, 2 undefined)
0m3.896s
You can implement step definitions for undefined steps with these snippets:
/**
* @Given /^I wait for "([^"]*)" seconds$/
*/
public function iWaitForSeconds($arg1)
{
throw new PendingException();
}
/behat_sample/features/search.feature
# features/search.feature
Feature: Search
In order to see a word definition
As a website user
I need to be able to search for a word
@javascript
Scenario: Searching for a page that does exist
Given I am on "/wiki/Main_Page"
When I fill in "search" with "Behavior Driven Development"
And I press "searchButton"
Then I should see "agile software development"
And I wait for "60" seconds
/behat_sample/behat.yml
#behat.yml
default:
paths:
features: features
bootstrap: '/behat_sample/features/bootstrap'
extensions:
Behat\MinkExtension\Extension:
base_url: 'http://en.wikipedia.org/'
goutte: ~
selenium2: ~
browser_name: chrome
/behat_sample/features/bootstrap/FeatureContext.php
namespace bootstrap;
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\MinkContext;
/**
* Features context.
*/
class FeatureContext extends MinkContext
{
/**
* Initializes context.
* Every scenario gets it's own context object.
*
* @param array $parameters context parameters (set them up through behat.yml)
*/
public function __construct(array $parameters)
{
// Initialize your context here
}
/**
* @Given /^I wait for (\d+) seconds$/
*/
public function iWaitForSeconds($seconds)
{
$this->getSession()->wait($seconds*1000);
throw new PendingException();
}