• What is Automation Testing - Advantages & Types of Tools
  • What is Selenium IDE, Selenium RC, Selenium WebDriver, Selenium Grid?
  • Selenium IDE, Firebug & Firepath Installation


  • Selenium WebDriver Architecture
  • Selenium Installation
  • Challenges and Limitations of Selenium
  • First Selenium WebDriver Script
  • Working with Firefox Browser
  • Solution - Failed To Launch Browser Using Selenium WebDriver
  • Working with Chrome Browser
  • Working with IE Browser
  • Difference Between FindElement & FindElements
  • Install Firebug, Fire path and other add on for Selenium
  • Locators in Selenium
  • Dynamic Xpath
  • Dynamic CSS
  • Handle drop-downs
  • How to work with file upload
  • Handle Alerts & Popups
  • Handle Multiple Windows
  • Mouse Hover event in Selenium
  • Right Click
  • Double Click
  • Drag and Drop
  • Capture Screenshots in Selenium
  • Parameterization
  • Synchronization
  • Implicit Wait, Explicit Wait and Fluent Wait in Selenium
  • Implicit Waits
  • Explicit WebDriver Waits
  • Fluent Wait In Selenium
  • Apache POI
  • How To Read Data From Excel File
  • How To Write Data In Excel File
  • Database Testing Using MSSQL
  • Database Testing Using MySQL
  • Database Testing Using DB2
  • Handle Ajax Call in Selenium
  • Listeners in Selenium
  • Handling JavaScript in Selenium
  • Stale Element Reference Exception in Selenium
  • Integrate Sikuli with Selenium
  • Headless Browser Testing 
  • Headless Browser Testing using HtmlUnitDriver
  • Headless Browser Testing using PhanthomJSDriver


  • TestNG Installation
  • TestNG Complete Tutorial


  • Extent Reports Introduction
  • Extent Reports Generation
  • Capturing Screenshots & Including In Extent Reports
  • Extent Reports Version 4


  • ANT Build Tool - How To Download & Install
  • Maven Build Tool - How To Download & Install
  • Creating Maven Selenium Project
  • GIT Integration with Selenium
  • Jenkins - How To Download & Install
  • Jenkins - Executing TestNG Scripts
  • Jenkins - Generating Reports After Test Execution
  • Jenkins - Executing Maven Project
  • Create build and Execute build for nightly execution
  • Send Email report based on build Status
  • Selenium Continuous Integration with Jenkins [Selenium – Maven – Git – Jenkins] – Step By Step Guide


  • Running Selenium Tests On BrowserStack
  • Kobiton - Mobile Testing Platform with Real Devices


  • Mobile Testing Platform with Real Devices


  • What is Framework & Types of Framework
  • Page Object Model Design Pattern
  • Data Driven Framework
  • How to explain Test Automation Framework or Selenium Automation Framework Architecture In Interview

  • API Testing:

  • Learn API Testing
  • Postman Tutorial (API Testing with Postman)


  • Test Automation Framework Interview Questions
  • Selenium Interview Questions
  • TestNG Interview Questions
  • Java Interview Questions
  • Python Interview Questions
  • API Testing Interview Questions


  • Automation Tester Resume
  • First Selenium WebDriver Script | Selenium Tutorial

    Creating First Selenium WebDriver Script:

    Here I don’t want to go in depth to show the first Selenium WebDriver script. I would like to keep it very simple.

    Hope you have already installed Selenium WebDriver. If not go through the below mentioned link to download and install Selenium WebDriver.

    How To Download And Install Selenium WebDriver

    In the first Selenium WebDriver Script, let’s see the below mentioned sceanario using Selenium WebDriver.

    To open appropriate URL and verify the title of the home page

    i. Open Firefox browser
    ii. Go to the specified URL
    iii. Verify the title and print the output of the title
    iv. Close the Firefox browser

    Test Data:
    Expected Value: Software Testing Material – A site for Software Testers

    To create our first Selenium WebDriver Script, we have to first create a Java Project, Package and Class in Eclipse.

    i. Create a Java Project “SoftwareTestingMaterial”
    ii. Create a package “seleniumTutorial”
    iii. Create a Java Class “FirstSeleniumWebDriverScript”

    Test script with an explanation:

    (Note: We use // text when we want to comment a single line of code. and use /* text */ when we want to comment multiple lines of code)

    Check out the below link for the complete list of Selenium WebDriver tutorials. There is a propaganda in the industry as learning and working on Selenium is very difficult. To be frank, learning Selenium is very easy.

    Selenium WebDriver Tutorial

    If you are not regular reader of my blog then I highly recommend you to sign up for the free email newsletter using the below link.

    Subscribe and get a free eBook and regular updates from

    First Selenium WebDriver Script

    Get our latest blog posts delivered to your inbox

    Subscribe and get popular blog posts about software testing industry.


    5 thoughts on “First Selenium WebDriver Script | Selenium Tutorial”

    1. Hi Rajkumar,

      eclipse not showing import option for WebDriver for WebDriver driver = new FirefoxDriver();
      could you please help me with this?

      • Hi Shruthi, it might be because of jars.. Check out whether you have added required Selenium Jars in your project or not. Check this post.

    2. Hi Raj,

      somehow eclipse not showing any suggestion. Yesterday it was working fine and all of sudden eclipse not showing any suggestion. I tried to restoring the default options in ‘Windows > Preferences > Java > Editor > Content Assist > Advanced’. and language(clr+space) but it didn’t work for me. I tried all other option which suggested on Google. still it is not working for me. can you please help me out.

      • Hi Shruthi, you said you have tried everything. So i suggest you to try Project – clean.. i think its under window in eclipsw.. also try restart your system.. if you find solution, just let us know how u resolved it

        • Hi Raj,
          I degrade the version of eclipse from oxygen to neon. Now it is working fine.

    Leave a Comment

    Share via
    Copy link
    Powered by Social Snap