0% found this document useful (0 votes)
3 views16 pages

Setup Guide

Uploaded by

vikas4uraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views16 pages

Setup Guide

Uploaded by

vikas4uraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

 Setup up Java:

1. Make sure you have Java install ( min 1.8 ) install,


To check if java is install go to cmd type java –version as shown

Above error shows java is not installed


To install go to
http://www.oracle.com/technetwork/java/javase/downloads/jdk
8-downloads-2133151.html

Down java as per your wondow’s version 32 or 64 bit as shown


below
Once downloaded, get it install by following wizard process.
Once it is installed, setup java variables as shown:
Set value in Path %JAVA_HOME%\bin as show below:
Now do cmd java –version again to check if java is installed or not:

Above message tells we have java 1.8 installed in our pc.

 Setup Maven 3.3.3


https://maven.apache.org/docs/3.3.3/release-notes.html

MAVEN_HOME (New Variable) =

%MAVEN_BIN%\bin (Path) =

 Setup up Eclipse :

Download Eclipse based on your window’s bit version 32 or 64 :


https://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-
developers/marsr

After downloading zip, extract the zip file which will have eclipse in it.
Now open eclipse application icon and set up a workspace as shown
below :
 Setting up Selenium_Automation Project in Eclipse:
Go to Files  new  Java Project

Click finish and your Java project will be created as shown below:
 Setting Selenium environment in Eclipse

Go to https://www.seleniumhq.org/download/

1.And download all required selenium API’s.

1. Selenium Standalone Server - 3.12.0

2. Depending on your language download respective API as shown:


3. Depending on which browser you want to automate you can
download its driver as shown :
Now extract all the zip files which you have download and import them
in project by right clicking on project  build path  Add external
libraries as shown below: (Note: Don’t add driver , only .jar file)
 First Selenium Script :

1. Create a main class as shown

src  new  class.


2. Give it a name , check main class and click finish as shown:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class MyFirstSeleniumScript {

public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver",
"C:\\Users\\xyz\\Downloads\\SeleniumAPIs\\
chromedriver_win32\\chromedriver.exe");

WebDriver driver = new ChromeDriver();

// for IE
// WebDriver driver = new InternetExplorerDriver()

// firefox

// WebDriver driver = new FirefoxDriver()

// to open brower and get to the url

driver.get("http://newtours.demoaut.com/");

// input[@name='username']

driver.findElement(By.xpath("//input[@name='userName']")).sendKeys("sunil_sel
enium");

driver.findElement(By.xpath("//input[@name='password']")).sendKeys("12345678"
);
driver.findElement(By.xpath("//input[@name='login']")).click();
}

You might also like