How to write a test case in selenium for beginners using eclipse

Create a project in Eclipse, say Test

eclipse_test_project

Right click on the project and Go to properties –> Java Build Path –> Libraries, click on Add External Jars and select all selenium jar files and add them into it.

Create a class file with name First,

Selenium first java file

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class First
{
		public static void main(String[] args)
		{
			System.setProperty("webdriver.gecko.driver", "D:\\geckodriver\\geckodriver.exe" );
			DesiredCapabilities capabilities=DesiredCapabilities.firefox();
			capabilities.setCapability("marionette", true);
			WebDriver driver = new FirefoxDriver();
			driver.get("http://blog.pikesteward.in/");
		}
}

Output:

selenium-output

1 thought on “How to write a test case in selenium for beginners using eclipse”

Leave a Reply

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