[go: up one dir, main page]

0% found this document useful (0 votes)
4 views3 pages

Experiment 6

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

Experiment 6

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

Experiment 6: Installation of Selenium: Selenium Web Driver and Selenium RC.

PART 1: Selenium WebDriver Installation and Setup

1. Install Java (JDK)

• Go to: https://www.oracle.com/java/technologies/javase-downloads.html

• Download the JDK for your OS (Windows/Linux/Mac).

• Run the installer and complete the installation.

Set Java path in Environment Variables:

• Search for “Environment Variables” in the Start menu.

• Click Environment Variables → Under System Variables, click Path → Edit.

• Add the path to the bin folder:


Example: C:\Program Files\Java\jdk-17\bin

Add new System variable:

• Variable Name: JAVA_HOME

• Variable Value: C:\Program Files\Java\jdk-17

Check Java installation in Command Prompt:

java -version

javac -version

Both should show the installed versions.

2. Install Eclipse IDE

• Visit: https://www.eclipse.org/downloads/

• Download Eclipse IDE for Java Developers.

• Extract and run eclipse.exe.

• Select a workspace folder and start Eclipse.

3. Download ChromeDriver

• In Chrome, go to: chrome://settings/help and note your version (e.g., 135.x).

• Go to: https://googlechromelabs.github.io/chrome-for-testing/

• Download the matching chromedriver-win64.zip.

• Extract it.
• Move chromedriver.exe to a folder like:
C:\chromedriver-win64

4. Download Selenium WebDriver JAR Files

• Visit: https://www.selenium.dev/downloads/

• Under Selenium Client & WebDriver Language Bindings, choose Java.

• Download and extract the ZIP (e.g., selenium-java-4.x.x.zip).

5. Create Java Project in Eclipse

• Open Eclipse → File → New → Java Project

• Project name: SeleniumProject

• Click Finish

6. Add Selenium JAR Files to Project

• Right-click the project → Build Path → Configure Build Path

• Go to Libraries tab → Click Add External JARs

• Select the following:

o selenium-java-4.x.x.jar

o selenium-chrome-driver-x.x.x.jar

o All .jar files inside the libs/ folder

• Click Apply and Close

7. Write a Simple WebDriver Program

package sel;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class Selenium1 {

public static void main(String[] args) {

// Set path to chromedriver

System.setProperty("webdriver.chrome.driver", "C:\\chromedriver-win64\\chromedriver.exe");
// Launch browser

WebDriver driver = new ChromeDriver();

// Open Google

driver.get("https://www.google.com");

// Print page title

System.out.println("Page title is: " + driver.getTitle());

// Close browser

driver.quit();

You might also like