尝试选中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