Awesome Browser Automation — Chapter 07

In this post, we will run our simple shop scenario using Browserstack infrastructure.

Sign up at Browserstack. By default, you get a free plan with 100 automation minutes per month. Minutes are counted for script execution time. Go to the settings page where you will found our browserstack user and key values. Browserstack has many features. For automation, the most essential element is that you can select various browsers and os combination, along with their versions.

Let’s observe chapter 07 pull request.


This is a new file. It is a template for environment variables that hold Browserstack user and key values:

cp .env_template .env

Enter Browserstack user and key secrets

source .env


We added the .env file as I do not want to be my Browserstack secrets publicly available. Even if you use private git repo, this is a good security practice.

Added chapter how to set up Browserstack secrets.


Added variables for Browserstack Browser and OS type and versions.


As you probably assumed, all config is taking place in env.rb file. This is Cucumber gem author decision. We load env variables using the ENV ruby method. This should be done before Before and After scenario methods. Using capabilities class, we set up Browserstack (or any remote selenium provider). Magic happens on line 48, where we create remote Browser class using :remote and Browserstack URL options.

Line 62 is Browserstack specific. If the scenario fails, you will know that from your console, but Browserstack does not have a clue what is happening inside the browser. So browser stack enables you to let it know when the scenario failed using rest API client. Here is the scenario result report on Browserstack. You have an execution video and Selenium action log:

Originally published at on January 15, 2020.

Founder of Tentamen, software testing agency.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store