函数passOver的可能性

时间:2017-08-10 15:36:15

标签: noraui

我正在与noraui一起开展自动测试。

我想打开一个subdropdown(button => click => dropdown => passOver => subdropdown)。此子下拉菜单只能与passOver一起显示,如果我们点击下拉菜单,则不会发生任何事情。

enter image description here

但我的passOver功能不起作用

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());
    }

}

步骤代码

@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)); }

我正在寻找passOver,就像鼠标悬停在dropdownmenu(“Miseàjour”)上一样。

0 个答案:

没有答案