First ProgramFor Selenium – Below Program will launch google and close the browser after 1 second
package SeleniumPractice;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class LaunchGoogle {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com/");
dowait();// 1 second wait so that you can see browser
driver.quit(); // Quit the Browser
}
public static void dowait() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}