Selenium with Cucumber

Getting started on BrowserStack with Cucumber

Get Started

Note: This tutorial requires browserstack-automate integration for Ruby.

BrowserStack supports Selenium automated tests using Cucumber.

Please ensure that Cucumber is available.

gem install cucumber

Running First Test

You can use the browserstack-automate integration to run your Cucumber tests on BrowserStack. It’s a simple two-step process:

Step 1 - Install ‘browserstack-automate’ integration

gem install browserstack-automate

Step 2 - Add it to your support/env.rb file

You just need to add this to your configuration file

require 'browserstack-automate'
BrowserStack.for "cucumber"

Rest of configuration file remains the same

# Enabling browserstack-automate ruby integration
require 'browserstack-automate'
BrowserStack.for "cucumber"

# Rest of the configuration file remains unchanged
browser = Selenium::WebDriver.for :firefox

Before do |scenario|
  @browser = browser

at_exit do

That’s it! You can now execute your tests on BrowserStack by using the RUN_ON_BSTACK, BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables.


We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked

Thank you for your valuable feedback