Downloading and configuring Selenium 4 WebDriver in Java Projects
Traditional Way – Normal Java Project
Follow the below steps for downloading and configuring the Selenium WebDriver in a Java Project:
- Create a new Java Project
- Create a new Class say Demo having main() method
- Create an object for ChromeDriver Class
- Create a new folder say ‘libraries’ inside the Project workspace
- Download latest stable version of Selenium from Selenium.dev
- Extract the folder and Paste the available jar files into the library folder and configure the Project
- Create a new folder ‘drivers’ and copy the compatible chrome driver
- Setting the Chrome Driver –
System.setProperty (“webdriver.chrome.driver” ,“./drivers/chromedriver.exe” ); - Run the code to see the Chrome Browser launching.
- Running scripts on different browsers
- Assigning the objects of the Browser Classes to the WebDriver Interface and creating a script which executes the scripts on different browsers based on the specified browser.
Real Time Way – Maven Project – WebDriverManager
- Create a Maven Project
- Add the required dependencies to pom.xml
- Running the scripts on different browsers
By,
Arun Motoori