Write First Selenium script



You have completed Ruby, selenium, cucumber installation steps described at the beginning of the tutorial. You have also downloaded the template project, imported in RubyMine. Please go through first basic cucumber scenario 




  1. Create a new feature file “first_selenium.feature”
  2. Write a Feature and then a scenario
  3. Open www.seleniumframework.com website
  4. Print the title, URL and page source for the website
  5. At the end of this page, a video will be posted



1. Right click “features” folder and add a new feature file “first_selenium.feature”






2. Lets describe the behavior of our scenario as follows





3. In RubyMine the file first_selenium.feature looks as below


4. Now right-click on step_definitions folder and add “first_selenium.rb” file




5. Copy and paste the below code in first_selenium.rb file



6. Right click on any line on the Scenario and Run as below




7. Browser should pop up, hit http://www.seleniumframework.com and print title, url and page source as in below screenshot




Note: You might have to scroll up in the right bottom scroll window to see pagetitle and url





1. My browser doesn’t launch¬†

Ans: Please check that you have completed the pre-requisites section

2. I get “Empty test suite” error

Ans: The most likely cause of this is a typo in your cucumber script

3. I need more help

Ans: Please write back to us on the Contact page if you are interested in tutorials

First Selenium Based Script