ich sah, dass es eine Frage ist: Selenium-Webdriver Ruby --> How to wait for images to be fully loaded after clickWarten auf ein Bild voll Selen geladen werden WebDriver
Aber es scheint, dass niemand direkt geantwortet hat, dass: ich für ein Bild warten müssen vollständig geladen werden, nicht nur im DOM mit Selen WebDriver zu präsentieren. Was soll ich tun? Derzeit bin ich mit
public static void waitUntilVisible(WebDriver webDriver, By locator) {
WebDriverWait driverWait = new WebDriverWait(webDriver, TIMEOUT);
driverWait.until(visibilityOfElementLocated(locator));
}
der
/**
* An expectation for checking that an element is present on the DOM of a page and visible.
* Visibility means that the element is not only displayed but also has a height and width that is
* greater than 0.
*
* @param locator used to find the element
* @return the WebElement once it is located and visible
*/
public static ExpectedCondition<WebElement> visibilityOfElementLocated(
final By locator) {
return new ExpectedCondition<WebElement>() {
@Override
public WebElement apply(WebDriver driver) {
try {
return elementIfVisible(findElement(locator, driver));
} catch (StaleElementReferenceException e) {
return null;
}
}
@Override
public String toString() {
return "visibility of element located by " + locator;
}
};
}
verwendet, aber wenn ein Bild bereits eine Höhe und Breite ist es wahrscheinlich als sichtbar gezählt, auch wenn das Bild nicht geladen ist