嘗試選中Behat/Mink/Selenium複選框時出現錯誤。以下是我的設置和我的錯誤的描述。Behat,水貂和硒。如何檢查複選框?
behat.yml
default:
extensions:
Behat\MinkExtension:
goutte: ~
selenium2: ~
composer.json
{
"require": {
"behat/behat": "~3.3",
"behat/mink-extension": "~2.2",
"behat/mink-goutte-driver": "~1.2",
"behat/mink-selenium2-driver": "~1.3"
},
"config": {
"bin-dir": "bin/"
}
}
我運行硒3.4.0這樣(包括壁虎駕駛員)
個java -Dwebdriver.gecko.driver=/home/ubuntu/path/to/geckodriver -jar selenium-server-standalone-3.4.0.jar
FeatureContext類別:
<?php
use Behat\MinkExtension\Context\MinkContext;
use Behat\Behat\Tester\Exception\PendingException;
/**
* Defines application features from the specific context.
*/
class FeatureContext extends MinkContext
{
}
?>
被測
Feature: Search
In order to use behat
As a tester
I need to be able to get all these componets to work!
@javascript
Scenario: A very simple test of behat functionality
Given I am on "http://behat-testing.christaylordeveloper.co.uk/"
Then I should see "MY BLOG"
And the "#slave-para" element should not contain "Hi there"
When I check "test-cb"
Then the "#slave-para" element should contain "Hi there"
錯誤
這種情況的特點是測試的表示mouseMoveTo錯誤
[email protected]:~/behat-tests$ bin/behat
Feature: Search
In order to use behat
As a tester
I need to be able to get all these componets to work!
@javascript
Scenario: A very simple test of behat functionality # features/simple-test.feature:7
Given I am on "http://behat-testing.christaylordeveloper.co.uk/" # FeatureContext::visit()
Then I should see "MY BLOG" # FeatureContext::assertPageContainsText()
And the "#slave-para" element should not contain "Hi there" # FeatureContext::assertElementNotContains()
When I check "test-cb" # FeatureContext::checkOption()
mouseMoveTo
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'ip-172-31-7-6', ip: '172.31.7.6', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-1018-aws', java.version: '1.8.0_131'
Driver info: driver.version: RemoteWebDriver (WebDriver\Exception\UnknownCommand)
Then the "#slave-para" element should contain "Hi there" # FeatureContext::assertElementContains()
--- Failed scenarios:
features/simple-test.feature:7
1 scenario (1 failed)
5 steps (3 passed, 1 failed, 1 skipped)
0m3.75s (10.46Mb)
如果我註釋掉@javascript標記並註釋掉該場景的最後一步(涉及到javascript),它就會通過。
如何在沒有此mouseMoveTo錯誤的情況下使用javascript進行測試?
謝謝
更新數2:
我現在有這個使用chromedriver版本2.32和硒獨立服務器3.5.3
我從這樣的命令行中運行的服務器工作:
java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone-3.5.3.jar
我的behat。陽明海運是
default:
extensions:
Behat\MinkExtension:
goutte: ~
selenium2: ~
browser_name: 'chrome'
謝謝伊戈爾。我已經爲我原來的問題添加了一個編輯。我有一種感覺,我的功能上下文類缺少一些必要的'use'語句,因爲我不能使用基本的預定義方法,比如'當我檢查'cb_id「',甚至像'當我按照'鏈接''。也許我錯過了什麼? – CTaylorGuitar
@CTaylorGuitar很奇怪,因爲所有的圖書館都在,你可以用'behat -dl'運行behat。如果你嘗試在featureContext的方法中調用'$ this-> checkOption('optionIdentifier')',你會得到什麼類型的錯誤? –
我已經編輯了原來的問題一次,現在我的情況和錯誤更清楚地解釋我希望。任何關於如何檢查與硒硒複選框感謝 – CTaylorGuitar