Reputation: 139
I'm doing automated tests of a web application in Java/Serenity.
There is a menue with submenues in the app. It's a javascript menu which opens submenues onmouseover. I need to open submenues of any level via Serenity. I'm doing it using the following code:
public void hoverElement(WebElementFacade element) {
Actions builder = new Actions(getDriver());
Actions hoverOverLocationSelector = builder.moveToElement(element);
hoverOverLocationSelector.perform();
}
It works very well in Firefox, but not in Chrome.
In Chrome, I have to call the hoverElement() function two or three times in a row to make it work. And this is not good.
Does anyone have ideas how to make it work without calling the function two or three times?
Thanks in advance.
Upvotes: 2
Views: 3754
Reputation: 163
Just came across this question, but might help others. This worked for me for choosing an item in a menu:
withAction().moveToElement(element(by_menu)).moveToElement(element(by_login)).click().build().perform();
It navigates to the menu, then to the item and then clicks. Build-perform
executes it in sequence
Upvotes: 0