I have a problem with my login test using behat,mink and selenium I got the error
Form field with id|name|label|value "username" not found.
My scenario :
@javascript
Scenario: View users list
Given I am on "http://localhost/admin"
Then I wait 60 seconds
And And I am authenticated as "admin" using "admin"
Then I should see "List of customers"
My FeatureContext.php:
/**
* @Then /^I wait (\d+) seconds$/
*/
public function iWaitSeconds($seconds)
{
sleep($seconds);
}
/**
* @Given /^And I am authenticated as "([^"]*)" using "([^"]*)"$/
*/
public function andIAmAuthenticatedAsUsing($username, $password) {
$this->visit('http://localhost/admin');
$this->getSession()->getPage()->find('css','input[name="username"]')->setValue($username);
$this->getSession()->getPage()->find('css','input[name="password"]')->setValue($password);
$this->pressButton('Login');
}
My behat.yml:
default:
extensions:
Behat\MinkExtension\Extension:
base_url: http:localhost/admin
browser_name: chrome
javascript_session: selenium2
selenium2:
browser: chrome
goutte: ~
paths:
features: features
bootstrap: features/bootstrap
I can't understand why this error because I have a form with this name : "username". Please help me. Thnx in advance.