Selenium – ways to handle dropdown menus

Every web Page has at least one drop down menu bar, the bar may be horizontal or vertical.

Each item in the menu bar is a link corresponds to another page.

Menu bar have root items and in each root items we have one or more sub menus/items.

Actions on Root elements of a menu bar can be done as normal links, but sub elements are ( are hidden) only visible if we mouse hover to their corresponding root element,

as shown in above screenshot, to get the AntReporting item, we need to mouse hover on Selenium item.


Let’s see code implementations

Another scenarios

This above Action mouse hover doesn’t work well, then we can use different approach like:

For each root or sub menu items, there is a url link associated, so instead of mouse hover directly use driver.get(“link of the root/sub menu item”);

Let’s see how this works:

To click on the Selenium -> ExcelRW item, instead of mouse hover, we can use the url link associated with the ExcelRW item i.e-

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our, Thanks!

2 Responses

  1. lakshmikanth says:

    Hi can u show the how to click the invisible element from boot strap drop down

  2. sunilpatro1985 says:

    If an option is invisible, you can’t select, you have to scroll down till the element is visible and then select
    refer and try any one ways from

Leave a Reply

Your email address will not be published. Required fields are marked *