From a9824093701b694de09b90a82c62dd987ca7566a Mon Sep 17 00:00:00 2001 From: SUMYAK JAIN <3456gaurav@gmail.com> Date: Fri, 28 Oct 2022 20:14:56 +0530 Subject: [PATCH] Create Basic_login --- Java Tutorial Program/Basic_login | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Java Tutorial Program/Basic_login diff --git a/Java Tutorial Program/Basic_login b/Java Tutorial Program/Basic_login new file mode 100644 index 0000000..746fd5e --- /dev/null +++ b/Java Tutorial Program/Basic_login @@ -0,0 +1,33 @@ +//Login program using selenium automation + +import org.openqa.selenium.By; + import org.openqa.selenium.JavascriptExecutor; + import org.openqa.selenium.WebDriver; + import org.openqa.selenium.WebElement; + import org.openqa.selenium.chrome.ChromeDriver; + +public class login_hackerearth { + + public static void main(String[] args) { + + // System Property for Chrome Driver + System.setProperty("webdriver.chrome.driver", "D:\\ChromeDriver\\chromedriver.exe"); + WebDriver driver = new ChromeDriver(); + // Launch Website + driver.navigate().to("https://www.hackerearth.com/"); + driver.manage().window().maximize(); + WebElement login = driver.findElement(By.cssSelector("#__next > div > div > div.header > div > div.buttons > div:nth-child(1)")); + login.click(); + WebElement email= driver.findElement(By.name("username")); + email.sendKeys(".."); + WebElement password= driver.findElement(By.name("password")); + password.sendKeys(".."); + WebElement log= driver.findElement(By.className("submitButton")); + log.click(); + driver.quit(); + System.out.println("login Successful"); + + + + + }}