Search code examples
seleniumonmouseoverfluentlenium

How to simulate a "on_mouse_over" on a drop down menu in Java


I'm using FluentLenium.

I'm trying to simulate a on_mouse_over in my java tests. I have to check some boxes in a drop down menu, it's an element not visible...

I have to move the mouse over to make visible this element and be able to use the method click() from FluentLenium.

How can i "simulate" a on_mouse_over in java?

Thanks


Solution

  • Thanks everyone for your help !

    I found the solution :

    Actions action = new Actions(driver);
    action.moveToElement(driver.findElement(By.cssSelector("ul.critereFiltrage")).findElement(By.cssSelector("a"))).moveToElement(driver.findElement(By.cssSelector("div.overview")).findElement(By.cssSelector("a"))).click().build().perform();
    

    To explain :

    • The first moveToElement() => To go on the A-tag to open the DropDown menu
    • The second moveToElement() => To go on the first item in the DropDown Menu
    • click() => click on the selected item
    • build() => To generate a composite action
    • perform() => To launch the built action.

    Thanks a lot,