Galera já tentei colocar Thread.sleep(10); depois do submit...
Já tentei colocar WebDriveWait ... WebDriver driver; driver = new FirefoxDriver(); WebDriverWait wait = new WebDriverWait(driver, 3); wait.until(ExpectedConditions.elementToBeClickable(By.name("usuario.nome")));
Já tentei colocar o driver.close(); antes do assertTrue.
Mas não consegui nada, o Selenium continua dando erro no teste de achar o nome e e-mail na tela após o cadastro.
Código atual: public class UsuariosSystemTest {
@Test public void deveAdicionarUmUsuario() throws InterruptedException {
WebDriver driver; System.setProperty("webdriver.gecko.driver","C:\develop\geckodriver.exe"); // driver =new FirefoxDriver();// driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver = new FirefoxDriver(); WebDriverWait wait = new WebDriverWait(driver, 3); wait.until(ExpectedConditions.elementToBeClickable(By.name("usuario.nome")));
driver.get("http://localhost:8080/usuarios/new"); //// WebElement nome = driver.findElement(By.name("usuario.nome")); WebElement email = driver.findElement(By.name("usuario.email"));
nome.sendKeys("ph"); email.sendKeys("ph@gmail.com"); nome.submit();
// Thread.sleep(10);
boolean achouNome = driver.getPageSource().contains("pg"); boolean achouEmail = driver.getPageSource().contains("ph@gmail.com");
// driver.close();
assertTrue(achouNome); assertTrue(achouEmail);
driver.close();
}
}