We are using the following code snippet in order to pass to the next test step safely.
private void waitTextPresent(String toBeExpectedText) throws InterruptedException {
for (int second = 0;; second++) {
if (second >= 60) {
// not found
}
try {
if (driver.findElement(By.cssSelector("BODY")).getText()
.matches(toBeExpectedText))
break;
} catch (Exception e) {
}
Thread.sleep(1000);
}
}
We are using Selenium 2.44.0 (This seems to be the stable release). Firefox version is 37.0 because v38 and v39 have problems and previous versions are slow.
However, even this code snippet runs too slow that the total time for testing is too long. Is there any way to re-write this snippet in a more effective way?
Aucun commentaire:
Enregistrer un commentaire