Steps:
- Go To gmail.com - OK
2.Fill valid Email - OK
3Press Next - OK
4 Find element by id="Passwd" FAIL
The test fails because of a valid input field id= "Passwd". But i checked gmail.com and the field have id="Passwd" and Name="Passwd". I Tried with CSS locator and test failed again.
I tried to put a time gap between Clicking "Next" and filling a password into field. Doesn`t help.
Maybe it`s because When you Put your Email into field and clicking "Next" there is some script which transfer "Email input form" to "Password input Form" How i can solve this problem?
import org.junit.After;
import org.junit.Test;
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.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class GmailSIgnInTest {
WebDriver driver = new FirefoxDriver();
@Test
public void loginShouldBeSuccessfull() {
driver.get("http://gmail.com");
WebElement userNameTextBox = driver.findElement(By.id("Email"));
userNameTextBox.clear();
userNameTextBox.sendKeys("MY EMAIL HERE");
WebElement userNextButtonClick = driver.findElement(By.id("next"));
userNextButtonClick.click();
WebElement userPasswordTextBox = driver.findElement(By.id("Passwd")); // TEST FAIL
userPasswordTextBox.clear();
userPasswordTextBox.sendKeys("MY PASSWORD HERE")
;
Aucun commentaire:
Enregistrer un commentaire