Skip to main content

Behat Launch Firefox browser using Mink Selenium2Driver

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.

#behat.yml
default:
  suites:
    default:
      paths:
        features: features
        bootstrap: 'features/bootstrap'
      contexts:
        - Behat\MinkExtension\Context\MinkContext
  extensions:
    Behat\MinkExtension:
      goutte: ~
      selenium2: ~
      browser_name: firefox
      default_session: selenium2
      base_url: http://automationpractice.com

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

Video Tutorial: Behat Launch Firefox browser using Mink Selenium2Driver

Tags
Submitted by tgoswami on September 29, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.