WebDriver Browser Commands


The Browser commands are generally the ones which we intuitively feel that a browser should control. Examples are “type url and hit enter”, “getTitle”,”back”,”forward” and so on. Read on to find out what Selenium provides



  1. Print browser name
  2. Print browser ready state
  3. Perform back, forwards and refresh browser operations


1. GoTo (Go to a URL)


2. Browsername


3. Browser ready state

4. Browser back

5. Browser forward

6. Browser refresh

7. Browser title

8. Browser current url



1. Open the template project in RubyMine



2. Right click on the features folder and create a feature file “browser_commands.feature”




3. Now copy the below gherkin code in “browser_commands.feature”


4. Now right-click on the step_definitions folder and create a new file “browser_commands.rb” [Watch the video at the end of this file to see how to do it step by step]




5. After adding both the browser_commands.feature and browser_commands.rb, your project should look like this




6. Now right click on each scenario (or if you wish to execute all scenarios) and run to see the output



Browser Commands