Initiating the Web Driver and Navigate to the Webpage
Further, we will define the location of ChromeDriver inside the setProperty function and initiate the ChromeDriver. Here, we have opened the Geeks for Geeks website (link) using the get() method.
get()
The get() method navigates the user to a certain webpage stated by him by opening that webpage in the respective browser.
Java
//Import selenium libraries import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.By; public class selenium4 { public static void main(String[] args) { // State the chromedriver URL System.setProperty( "webdriver.chrome.driver" , "C:\\Users\\Vinayak Rai\\Downloads\\chromedriver-win64\\chromedriver-win64\\chromedriver.exe" ); // Define and initiate the chrome driver WebDriver driver = new ChromeDriver(); // Open the Geeks For Geeks website driver.get( "https://www.w3wiki.org/explore?page=1&sortBy=submissions&itm_source=w3wiki&itm_medium=main_header&itm_campaign=practice_header" ); } } |
Selenium Webdriver Handling Checkbox using Java
A set of tools and libraries that allow the user to automate interactions with web browsers is known as Selenium. It is too diverse tool that can handle every operation of a webpage starting from opening the webpage to closing of webpage. In this article, we will see the various steps to handle the checkboxes using Selenium webdriver in Java.