public void hover() {
        String cantHover = "Unable to hover over ";
        String action = "Hovering over " + prettyOutput();
        String expected = prettyOutputStart() + " is present, and displayed to be hovered over";
        try {
            // wait for element to be present
            if (isNotPresent(action, expected, cantHover)) {
                return;
            }
            // wait for element to be displayed
            if (isNotDisplayed(action, expected, cantHover)) {
                return;
            }
            Actions selAction = new Actions(driver);
            WebElement webElement = getWebElement();
            selAction.moveToElement(webElement).perform();
        } catch (Exception e) {
            log.warn(e);
            reporter.fail(action, expected, cantHover + prettyOutputEnd() + e.getMessage());
            return;
        }
        reporter.pass(action, expected, "Hovered over " + prettyOutputEnd().trim());
    }
public void hover ( ) { String cantHover = "Unable to hover over " ; String action = "Hovering over " + prettyOutput ( ) ; String expected = prettyOutputStart ( ) + " is present, and displayed to be hovered over" ; try { if ( isNotPresent ( action , expected , cantHover ) ) { return ; } if ( isNotDisplayed ( action , expected , cantHover ) ) { return ; } Actions selAction = new Actions ( driver ) ; WebElement webElement = getWebElement ( ) ; selAction . moveToElement ( webElement ) . perform ( ) ; } catch ( Exception e ) { log . warn ( e ) ; reporter . fail ( action , expected , cantHover + prettyOutputEnd ( ) + e . getMessage ( ) ) ; return ; } reporter . pass ( action , expected , "Hovered over " + prettyOutputEnd ( ) . trim ( ) ) ; }
Hovers over the element, but only if the element is present and
displayed. If those conditions are not met, the hover action will be
logged, but skipped and the test will continue.