나는 셀레늄 테스트에서 초보자입니다. 나는 selenium2, behat 및 밍크를 사용하려고합니다. 브라우저로서 firefox (v52.0.1)를 사용합니다. 나는 위키 검색 (behat 문서에서 예제)을 테스트하려고 할 때 문제가있다. 문제는 페이지의 아무 요소 나 클릭하려고 할 때입니다. 그러면 콘솔 출력은 다음과 같습니다.셀렌, 멧돼지 및 밍크를 사용하여 elementu를 클릭하는 방법?
And I press "searchButton" # FeatureContext::pressButton()
mouseMoveTo
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'dominik-Lenovo-G580', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-66-generic', java.version: '1.8.0_131'
Driver info: driver.version: RemoteWebDriver (WebDriver\Exception\UnknownCommand)
내 구성 및 일부 코드 아래에 있습니다.
composer.json
{
"require": {
"behat/behat": "~3.0.5",
"behat/mink-extension": "^2.2",
"behat/mink-goutte-driver": "^1.2",
"behat/mink-selenium2-driver": "~1.2"
},
"config": {
"bin-dir": "bin/"
}
}
behat.yml
default:
extensions:
Behat\MinkExtension:
base_url: http://en.wikipedia.org
default_session: selenium2
goutte: ~
selenium2: ~
search.feature
Feature: Search
In order to see a word definition
As a website user
I need to be able to search for a word
Scenario: Searching for a page that does exist
Given I am on "/wiki/Main_Page"
When I fill in "search" with "Behavior Driven Development"
And I press "searchButton" # <- the problem is on this step.
Then I should see "agile software development"
FeatureContext.php
<?php
use Behat\Behat\Tester\Exception\PendingException;
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\MinkExtension\Context\MinkContext;
class FeatureContext extends MinkContext implements Context, SnippetAcceptingContext
{
/**
* @Given I click the :arg1
*/
public function iClickTheElement($selector) // I also tried to use And I click the ".searchButton" but result is the same
{
$page = $this->getSession()->getPage();
$element = $page->find('css', $selector);
if (empty($element)) {
throw new Exception("No html element found for the selector ('$selector')");
}
$element->click();
}
}
,451,515,
콘솔 출력 :
는이 문제에 대해 어떤 생각을 가지고 있습니까? 나는 어떤 조언을해도 대단히 감사 할 것이다.
감사합니다.
업데이트 : Chrome을 테스트 할 때 Everythink가 잘 작동합니다.
Safari를 사용하고 있습니까? 이 경우 알려진 문제이므로 다른 브라우저를 사용해보십시오. https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/4136 Safari를 사용하지 않는 경우 여전히 다른 브라우저를 사용해 보시겠습니까? 현재 Chrome을 사용하지 않는 경우 Chrome을 사용해보세요. 현재 Chrome을 사용하고 계시다면 Firefox 버전 44를 다운로드하여 사용해보십시오 (Selenium2는 최신 Firefox와 관련된 문제가 있음). –
firefox 52를 사용하고 있습니다. Chrome을 사용해 보았지만 webdriver에 또 다른 문제가 있습니다. –
마침내 나는 크롬에서 그것을했고 everythink는 잘 작동한다. –