We use the get
method to go to a website. For Example, this would open google
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "path of the exe file\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https:www.google.com");
Thread.sleep(3000); //wait for 3 seconds
driver.quit(); //close Chrome
}
driver.quit()
closes the Browser. To create a delay, we use Thread.sleep(3000)
.