Automation in Selenium (JAVA)

Code Written was in Eclipse LUNA

import org.openqa.selenium.safari.SafariDriver;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.browserlaunchers.locators.InternetExplorerLocator;


import org.openqa.selenium.firefox.FirefoxDriver;

public class LoginTestCase {

public static void main(String[] args) {

//Creating the Firefox object

WebDriver driver = new FirefoxDriver();

// Opening the ABC WebSite.

driver.navigate().to(“ “);

//Showing the opened success message

String LoadMsg=”Successfully opened the ABC WebSite”;


// Entering the User Name

WebElement UserName = driver.findElement(“txtErUsername”));


// Entering the Password

WebElement PassWord = driver.findElement(“txtErPassword”));


// Clicking on login button

WebElement login = driver.findElement(“BtnEm”));;

//Showing the Login success message

String LoginMsg=”Successfully login the ABC WebSite “;


// Now moving towards the menu page

WebElement TopMenu = driver.findElement(By.className(“rmLeftImage”));;



Note: How to Configure Eclipse and Add Jar files can be learn from following link.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: