.
How to Install Java JDK on MacOS: • How to Install Java JDK on Windows
How to Install Eclipse IDE on MacOS: • How to Install Eclipse IDE on Windows
1. CREATE A JAVA PROJECT ON ECLIPSE
Create com.neotech package
Create ChromeBrowserDemo class
2. DOWNLOAD SELENIUM 4 JAR FILES
Go to https://www.selenium.dev/downloads/
Download Selenium JARs in a zip file
Move the zip file to a safe folder (Documents/JarFiles)
Unzip the file. It will create a folder selenium-java-4
3. ADD EXTERNAL JARs TO THE CURRENT PROJECT
Right Click on the Project -- Build Path -- Configure Build Path...
Click on Libraries tab
Click on Classpath
Click on Add External JARs
Add all the Selenium Libraries that are under "selenium-java-4..." folder
Click on "Apply and Close"
----------------------------------------------------------------
Sample code:
----------------------------------------------------------------
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new ChromeDriver();
driver.get("https://www.neotechacademy.com/");
Thread.sleep(5000); // 5000 milliseconds = 5 seconds
driver.quit();
}