How to automate gmail login process using selenium webdriver in java?

in selenium
selenium Tutorials
1 Answers to this question

System.setProperty("webdriver.gecko.driver","C:\\your_directory\\geckodriver.exe");


    WebDriver driver = new FirefoxDriver();


    driver.manage().window().maximize();


    String url = "https://accounts.google.com/signin";


    driver.get(url);


    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 


    WebElement email_phone = driver.findElement(By.xpath("//input[@id='identifierId']"));


    email_phone.sendKeys("your_email_phone");


    driver.findElement(By.id("identifierNext")).click();


    WebElement password = driver.findElement(By.xpath("//input[@name='password']"));


    WebDriverWait wait = new WebDriverWait(driver, 20);


    wait.until(ExpectedConditions.elementToBeClickable(password));


    password.sendKeys("your_password");


    driver.findElement(By.id("passwordNext")).click();

If you want to unleash your potential in this competitive field, please visit the Selenium Certification Training page for more information, where you can find the    Selenium Tutorial    and    Selenium Interview Questions FAQ's and answers    as well.

For more updates on the latest courses stay tuned to HKR Trainings.

To Top