user7424312
user7424312

Reputation: 137

Chrome is not started with selenium and behat

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.

Upvotes: 0

Views: 1090

Answers (1)

lauda
lauda

Reputation: 4173

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.

Upvotes: 1

Related Questions