Thursday, 26 March 2015

Mouse Hover action in Selenium Webdriver

There will be situations where it is required to click on the item of the drop down menu for e.g. Go toToolsQA demo online store > Click on Product category link on the top menu > Then select any of the items from the drop down menu:
See the screen shot below:
Mouse_Hover
One way of doing this is by using Action class:
It can be done differently like this:
With some of the browser it happens that once mouse hover action is performed, the menu list disappear with in the fractions of seconds before Selenium identify the next submenu item and perform click action on it. In that case it is better to use ‘perform()’ action on the main menu to hold the menu list till the time Selenium identify the sub menu item and click on it.
Note: The above codes work most of the time but you may see different behaviour with different OS machines and different browsers.

No comments:

Post a Comment