How to mouse hover on a web element using Selenium WebDriver?

WebDriver offers a wide range of interaction utilities that the user can exploit to automate mouse and keyboard events. Action Interface is one such utility which simulates the single user interactions.

Thus, In the following scenario, we have used Action Interface to mouse hover on a drop down which then opens a list of options.

//Instantiating Action Interface
Actions actions = new Actions(driver);

//hover on the dropdown
actions.moveToElement(driver.findElement(By.id(""))).perform();

//Clicking on one of the items in the list options
WebElement subLink = driver.findElement(By.id(""));
subLink.click();