Skip to main content

Behat Launch Chrome Browser using Mink Selenium2Driver

Selenium2Driver provides a bridge for the Selenium2 (webdriver) tool. To launch chrome 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. Download Chrome browser compatible with your browser and OS from Here.

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

$ java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone-3.141.59.jar

Step 5: Make sure your behat.yml is configure properly. Selenium2 driver is enabled, default session is set and browser name is added.

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

Step 6: Add following steps to feature file.

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

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

$ bin/behat

Video Tutorial: Behat Launch Chrome Browser using Mink Selenium2Driver

Submitted by tgoswami on September 8, 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.