Behat Launch Firefox browser using Mink Selenium2Driver

Profile picture for user devraj

You can also launch Firefox browser using Mink Selenium2Driver. To launch firefox driver follow below steps:

Step 1: Make sure Selenium2Driver is installed using Composer, you can check your composer file for that. Otherwise execute below command.

$ composer require --dev behat/mink-selenium2-driver

Step 2: Download Selenium Server from Here, click on latest stable version.

Step 3: Check you browser version and check it is compatible with which driver from here.

Step 4: Download Firefox gecko compatible with your browser and OS from Here.

Step 5: Run below command in the directory where you have downloaded your server and firefox file otherwise you can give the path of directory. For me both files are in same directory.

$ java -Dwebdriver.gecko.driver=geckodriver -jar selenium-server-standalone-3.141.59.jar

Step 6: Make sure your behat.yml is configure properly. Selenium2 driver is enabled, default session is set and browser name is added. For firefox you can skip browser_name. By default it starts on firefox.

        features: features
        bootstrap: 'features/bootstrap'
        - Behat\MinkExtension\Context\MinkContext
      goutte: ~
      selenium2: ~
      browser_name: firefox
      default_session: selenium2

Step 7: Add following steps to feature file.

Feature: Login
  Scenario: My First login
    Given I am on the homepage
    Then I follow "Sign in"

Step 8: Execute using below command. Path might be different for you.

$ bin/behat