Selineium Webdriver Submenu item not getting Clicked


I have a web page and there is a main Menu which on Hovering the mouse shows a submenu items.The Process of hovering on the main menu is working it displayed the submenu but when I try to click I get error as below even after the element is seen.

org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 16 milliseconds
Build info: version: ‘2.44.0’, revision: ’76d78cf’, time: ‘2014-10-23 20:03:00’
System info: host: ‘Deepali’, ip: ‘’, ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.7.0_25’
Session ID: 03f287d2-7ee4-43c8-ad7a-8f35134577ea
Driver info: org.openqa.selenium.firefox.FirefoxDriver

My Code is as below:


//Hover the mouse on Paitient and Select Registartion Submenu

WebElement mainMenu = driver.findElement(By.xpath(“//*[@id=’menuPatient’]”));

// //Initiate mouse action using Actions class

Actions builder = new Actions(driver);

Actions action = new Actions(driver);

// // move the mouse to the earlier identified menu option

// //builder.moveToElement(mainMenu).build().perform();

// builder.moveToElement(mainMenu).perform();


// //identify menu option from the resulting menu display and click



boolean actualValue = mainMenu.isDisplayed();

if (actualValue)

System.out.println(“mainMenu is displayed”);


System.out.println(“mainMenu is not displayed”);

// driver.switchTo().window(driver.getTitle());

WebElement menuOption = driver.findElement(By.xpath(“//*[@id=’subMenu20′]/ul/li[1]/a”));

// WebElement menuOption = driver.findElement(By.linkText(“Register”));


// builder.moveToElement(mainMenu).moveToElement(menuOption).click().perform();


boolean actualValue1 = menuOption.isDisplayed();

if (actualValue1)

System.out.println(“Submenu is displayed”);


System.out.println(“Submenu is not displayed”);




Output in console is as below

mainMenu is displayed

Submenu is not displayed

Default Asked on January 5, 2015 in Selenium WebDriver.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.