Chrome is not started with selenium and behat

匿名 (未验证) 提交于 2019-12-03 01:39:01

问题:

Please help. I use windows to run my tests. I run selenium with chrome driver:

 java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.4.0.jar 

My behat_dev.yml :

default: suites:     default:         mink_session: selenium2         javascript_session: selenium2         extensions:             Behat\MinkExtension:                 base_url: http://en.wikipedia.org                 default_session   : selenium2                 javascript_session: selenium2                 browser_name      : chrome                 goutte: ~                 selenium2         :                     wd_host     : http://127.0.0.1:4444/wd/hub                     browser: chrome                     capabilities: { "browserName": "chrome", "browser": "chrome", "version":  "", 'chrome': {'switches':['--no-sandbox']} }                 sessions:                     default:                         selenium2: ~ 

My scenario :

Feature: Home page     I am on a home page @javascript Scenario: Searching for a page with autocompletion   Given I am on "/wiki/Main_Page"   When I fill in "search" with "Behavior Driv"   And I wait for the suggestion box to appear   Then I should see "Behavior-driven development" 

The selenium is starting whitout problems, but when I try to run the tests nothing happen. The browser is not open. Please help me !!!!!! Thx in advance and sorry for my english.

回答1:

You don't have to set wd_host for local run unless you are using a different port.

It should work with some simple config like:

default:   suites:     default:       contexts:         - FeatureContext   extensions:     Behat\MinkExtension:       base_url: 'http://en.wikipedia.org'       selenium2:         browser: chrome 

Make sure you keep the indentation in yml, suites is under first default, not at the same level.

For extra verbosity use a -vvv at the end.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!