Instead of sleep
public
void
clickOntaskType() {
getDriver().findElement(By.id(
"tasktypelink"
)).click();
sleep(
500
);
}
Prefer this fluentWait
public
void
clickOntaskType
() {
getDriver().findElement(By.id(
"tasktypelink"
)).click();
SeleniumUtil.fluentWait(By.name(
"handle"
), getDriver());
}
It’s more robust, deterministic, in case of element not found… the exception will be clearer.
Another alternative is
(
new
WebDriverWait(driver,
30
)).until(
new
ExpectedCondition() {
public
Boolean apply(WebDriver d) {
return
d.getTitle().toLowerCase().startsWith(
"Awesome Tester"
);