I am trying to automate google login but I cannot proceed to the password field due to the error. I'm stuck after inputting the email address. The xPath is correct but I got that error.
Here is my code:
COMMONMETHODS PAGE:
public void waitForElementToBeVisible(WebElement element) {
try {
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.visibilityOf(element));
}
catch(Exception ex)
{
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.visibilityOf(element));
}
}
public void waitForElementToBePresent(By locator) {
WebDriverWait wait = new WebDriverWait(driver, 40);
wait.until(ExpectedConditions.presenceOfElementLocated(locator));
}
/**
* This method find webelement in the dom
*
* @param selectorScheme
* @return WebElement
*/
public WebElement getElement(By selectorScheme) {
return driver.findElement(selectorScheme);
}
```
LOGIN PAGE
```
@Step("Click Next button")
public GoogleLoginPage clickNextBtn() {
commonMethods.waitForElementToBeVisible(googleLoginElements.getNextBtn());
googleLoginElements.getNextBtn().click();
return this;
}
```
ELEMENTS PAGE:
```
public WebElement getNextBtn() {
return commonMethods.getElement(GoogleLoginSelectors.nextBtn);
}
```
SELECTORS PAGE:
```
public final static By nextBtn = By.xpath("//span[contains(text(),'Next')]");