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

Sharing is caring.

Share on facebook
Share on twitter
Share on linkedin

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

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?

    1. 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.

    1. 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

Leave a Comment

Your email address will not be published. Required fields are marked *

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook