You can check this in two ways: 1) the first way is to use the action constructor
WebElement mnuElement; WebElement submnuElement; mnEle = driver.findElement(By.Id("mnEle")).Click(); sbEle = driver.findElement(By.Id("sbEle")).Click(); Actions builder = new Actions(driver); // Move cursor to the Main Menu Element builder.MoveToElement(mnEle).Perform(); // Giving 5 Secs for submenu to be displayed Thread.sleep(5000L); // Clicking on the Hidden SubMenu driver.findElement(By.Id("sbEle")).Click();
Look here
2) another approach is to click directly on the required element using jscript without simulating a mouseover event:
String cssLocatorOfTheElement=....//locator of the element to click on JavascriptExecutor js = (JavascriptExecutor) driver; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("var x = $(\'"+cssLocatorOfTheElement+"\');"); stringBuilder.append("x.click();"); js.executeScript(stringBuilder.toString());
hope this works for you)
source share