The goal is to login to a Google account with the webdriver. This should be very simple! Although after moving past the email stage the program is unable to enter the password properly.
I think the problem may be that the program is trying to search for the password input element before the password page has been fully loaded. I have tried searching for ways to force the program to wait for the element to appear but everywhere I've looked only the outdated driver.wait function is used.
function age(email, pw) {
var driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
//go to login page
driver.get('https://accounts.google.com/signin/v2/identifier');
//enter email
driver.findElement(webdriver.By.xpath('//*[@id="identifierId"]')).sendKeys(email);
//next page
driver.findElement(webdriver.By.xpath('//*[@id="identifierNext"]/content/span')).click();
//enter password
driver.findElement(webdriver.By.xpath('//*[@id="password"]/div[1]/div/div[1]/input')).sendKeys(pw);
//complete login
driver.findElement(webdriver.By.xpath('//*[@id="passwordNext"]/content/span')).click();
}
Currently the program enters the email and moves to the password page correctly but then does not enter the password or attempt to click the "next" button to complete the login.
I've been looking everywhere for a solution. Please help!