Selenium Java Setup
We need to do setup to run any Selenium script in any computer.
In this tutorial, We
will do selenium setup step by step as below:
- Java Development Kit (JDK): First, we need to install JDK to execute script.
- Eclipse: then we need to install Eclipse ID that will help us to write selenium scripts with code intellisense.
- Browser Driver: then we will need to download specific browser drivers (e.g., ChromeDriver, GeckoDriver) to interact with browsers.
- Selenium Java Library: and finally, we will need to add Selenium Java library Jar files to write test scripts. It provides classes that will help us to perform various actions.
1. Install Java Development Kit (JDK)
- Download JDK: Visit Oracle’s JDK download page or use OpenJDK.
- Install JDK: Follow the instructions on the same page to install it on your machine.
- Add JDK to path: Add Installed JDK to your systems path so that its accessible across the system.
- Verify the installation: Run
java -version
command in your terminal It should display the java version you have installed.
2. Install Eclipse IDE
- Download Eclipse: Visit the Eclipse download page and download the "Eclipse IDE for Java Developers" as per your system.
- Install Eclipse: Extract the downloaded file and launch the installer.
- Open Eclipse: Start Eclipse and select a workspace directory for your projects.
3. Download Browser Driver
- Choose Browser Driver: Based on your browser type and version, download
the appropriate driver:
- For Chrome Driver: https://googlechromelabs.github.io/chrome-for-testing/
- For Firefox Driver:https://github.com/mozilla/geckodriver
4. Download Selenium Java Library
- Visit Selenium Downloads: Go to https://www.selenium.dev/downloads/
- Download Java: Under the Selenium Client & WebDriver Language Bindings section, download the Java version.
- Extract Files: Extract the downloaded ZIP file to a folder.
Now the setup is done next we will write our first selenium
script.