• tahseenat

Mouse Hover Selenium Actions



In order to perform a 'mouse hover' action, we need to chain all of the actions that we want to achieve in one go. So move to the element that has sub-elements and click on the child item. It should the same way that we do normally to click on a sub-menu item.

With the actions object you should first move the menu title, and then move to the submenu item and click it.

First, we need to create a new action builder instance bypassing the web driver instance, then.


Below is the sample code to perform Mouse hover action


Actions actions = new Actions(driver);

WebElement mainMenu = driver.findElement(By.linkText("menulink"));

actions.moveToElement(mainMenu);

WebElement subMenu = driver.findElement(By.cssSelector("subLinklocator"));

actions.moveToElement(subMenu);

actions.click().build().perform();


There are cases where you may just want to mouse hover on a particular element and check if the button state/color is changing after mouse hover.


Below is the example to perform mouse hover


WebElement searchBtn = driver.findElement(By.id("searchbtn"));

Actions action = new Actions(driver);

action.moveToElement(searchBtn).perform();

Wizdom QA has created an end to end course curriculum for the SDET profile. Our students will receive in-depth knowledge of the latest QA tools, techniques and programming languages.

As a registered student, you will learn Selenium WebDriver, Appium for Mobile App automation, API automation, CI/CD integration and many more.

We have studied the market carefully and understood that there is a huge demand for good SDET profiles, however, finding the right candidate is quite hard because of the lack of right skills and experience among job seekers.

 

Therefore we are here with 11+ years of hands-on and training 800+ students to experience to create one-stop-shop course content for Software Development Engineering in Test (SDETs).

Address

Belgard Square West, Tallaght,

Dublin, Ireland

Phone & WhatsApp

+353 894740999

Email

info@wizdomqa.com

support@wizdomqa.com

Additional Links

Wizdom QA Trainings | All rights reserved | 2019-20 ©

  • Facebook Social Icon