dimanche 22 février 2015

Selenium autotest can't login with good credentials, but human can

This is my selenium java test. I can login using my credentials on website, but selenium automatic test can not!


What could be the reason?



public void main() {
WebElement phone_field= firefox.findElement(By.xpath("//*[@id=\"login-form\"]/div[1]/span/input"));
WebElement password_field= firefox.findElement(By.xpath("//*[@id=\"login-form\"]/div[2]/span/input[@name=\"password\"]"));

Assert.assertNotNull(phone_field);
Assert.assertNotNull(password_field);

Assert.assertTrue(phone_field.isDisplayed());
Assert.assertTrue(password_field.isDisplayed());

phone_field.clear();
password_field.clear();

phone_field.sendKeys("5555555555");
password_field.sendKeys("222kek");

WebDriverWait wait = new WebDriverWait(firefox,3);
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@class='form-wrapper']")));

firefox.findElement(By.cssSelector("input.button.blue")).click();
String newUrl = firefox.getCurrentUrl();
System.out.println(newUrl);


se


Might it be the case that I need to make selenium wait for a bit,i.e. it presses on the blue login button too quickly?


Aucun commentaire:

Enregistrer un commentaire