我已经安装了具有依赖关系的作曲家:
{
"require": {
"behat/behat": "^3.5",
"behat/mink-extension": "^2.3",
"behat/mink-goutte-driver": "^1.2",
"behat/mink-selenium2-driver": "^1.3"
}
}
这是我的behat.yml:
# behat.yml
default:
extensions:
Behat\MinkExtension:
base_url: 'https://www.nu.nl'
browser_name: chrome
sessions:
default:
goutte: ~
selenium2:
selenium2:
capabilities: { "browserName": "chrome", "browser": "chrome", 'chrome': {'switches':['--no-sandbox']}}
suites:
my_suite:
contexts:
- Behat\MinkExtension\Context\MinkContext
我按照功能定义开始了javascript会话:
Feature: Test
Scenario: Loadpage
Given I am on "/"
Then I should see "Voorpagina"
@javascript
Scenario: Search
Given I am on "/net-binnen"
Then I should see "Voorpagina"
对于javascript场景,当运行vendor / behat / behat / bin / behat时,页面上显示文本“ Voorpagina”时,我将收到此错误。一切正常,包括打开浏览器,除了“然后我应该看到”会导致NoSuchElement异常。
@javascript
Scenario: Search # features/test.feature:8
Given I am on "/net-binnen" # Behat\MinkExtension\Context\MinkContext::visit()
Then I should see "Voorpagina" # Behat\MinkExtension\Context\MinkContext::assertPageContainsText()
Element not found with xpath, //html
(WebDriver\Exception\NoSuchElement)
--- Gefaalde scenario's: