Java, .NET, PHP, PYTHON, ANGULAR, .NET, ML, Data Scince, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

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

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post