1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| //----------------Test si un lien est affiché---------------------------------------
WebElement Box = driver.findElement(By.className("logo"));
Util.wait(3);
{
try
{
if(Box.isDisplayed()){
Box.click();
}
} catch(NoSuchElementException nsee){
System.out.println(nsee.toString());
System.out.println("The logo bar is not displayed");
}
finally {
System.out.println("Unable to locate the object");
System.exit(0);
}
//-----------------Test si le lien est cliquable-------------------------------------
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.elementToBeClickable(By.className("logo")));
try {
if (Box != null && Box.isEnabled());
{
return;
}
} catch (StaleElementReferenceException e) {
//return;
System.out.println("The logo bar is not clickable");
}
finally {
System.out.println("Unable to locate the object");
System.exit(0);
}
Util.wait(3);
driver.findElement(By.className("logo")).click();
Util.wait(3);
}
--------------------------------------------------------------------------------------- |
Partager