3

I'm working on autotest with noraui.

I would like to open a subdropdown (button => click => dropdown => passOver => subdropdown). This subdropdown can only appear with a passOver, if we click on the dropdownmenu, nothing happen.

enter image description here

But my passOver function doesn't work

protected void passOver(PageElement element) throws TechnicalException, FailureException {

    try {
        String javascript = "var evObj = document.createEvent('MouseEvents');" + "evObj.initMouseEvent(\"mouseover\",true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);"
                + "arguments[0].dispatchEvent(evObj);";
        ((JavascriptExecutor) getDriver()).executeScript(javascript, Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(element))));
    } catch (Exception e) {
        new Result.Failure<>(e.getMessage(), Messages.format(Messages.FAIL_MESSAGE_UNABLE_TO_PASS_OVER_ELEMENT, element, element.getPage().getApplication()), true,
                element.getPage().getCallBack());
    }

}

The steps code

@When("I pass over on '(.*)-(.*)'")
public void passOver(String page, String toPassOver) throws TechnicalException, FailureException {

  loggerStep.debug(page + " passOver: " + toPassOver);
  passOver(Page.getInstance(page).getPageElementByKey('-' + toPassOver)); }

I'm looking for passOver works like a mouse hovering the dropdownmenu ("Mise à jour").

Stéphane GRILLON
  • 11,140
  • 10
  • 85
  • 154

0 Answers0