Gmail Login Script in Web Driver

0


Gmail Login Script in Web Driver:-
package scs;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class FaceBookLogin {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","c:\\chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.get("https://www.gmail.com/");
    WebElement txtname = driver.findElement(By.name("identifier"));
    txtname.sendKeys("sagargupta462@gmail.com");
      WebElement btn = driver.findElement(By.className("CwaK9"));
    btn.click();
    driver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS) ;
    WebElement txtpass = driver.findElement(By.name("password"));
    WebDriverWait wait = new WebDriverWait(driver, 20);
    wait.until(ExpectedConditions.elementToBeClickable(txtpass));
    txtpass.sendKeys("angel0716");
    //driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS) ;
    driver.findElement(By.id("passwordNext")).click();
}
}


Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)