Need help.. Gmail login script not identifying password | Selenium Forum
M
Posted on 02/12/2016
Hi Everyone,

Please see below code, which I am trying to execute for login to gmail. I am not sure why system is not capturing the password. It identifies the user name correctly, given through script, but not password. Please can you suggest.


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;


public class Xpath {

public static void main(String[] args) {

ProfilesIni profile = new ProfilesIni();

FirefoxProfile myprofile = profile.getProfile("Abhi_Selenium");

WebDriver driver = new FirefoxDriver(myprofile);

driver.get("https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/#identifier");

WebElement email = driver.findElement(By.xpath("//*[@id='Email']"));
email.sendKeys("mylogin");

WebElement click = driver.findElement(By.xpath("//*[@id='next']"));
click.click();

WebElement Password = driver.findElement(By.xpath("//*[@id='Passwd']"));
Password.sendKeys("mypassword");



}

}





Thanks,
Abhishek

M
Replied on 04/12/2016

Add ---[u:3rdiehm7][b:3rdiehm7]Thread.sleep(3000);[/b:3rdiehm7][/u:3rdiehm7] after

"WebElement click = driver.findElement(By.xpath("//*[@id='next']"));
click.click();"


M
Replied on 09/12/2016

Please use implicitwait in all your programs