【发布时间】:2015-02-06 20:28:53
【问题描述】:
我在使用 behat、mink 和 selenium 进行登录测试时遇到问题 我得到了错误
Form field with id|name|label|value "username" not found.
我的场景:
@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"
我的 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');
}
我的 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
我不明白为什么会出现此错误,因为我有一个名称为“用户名”的表单。请帮我。提前谢谢。
【问题讨论】:
标签: php selenium-chromedriver behat mink