How to perform mouseover events in selenium web driver using java

Automate mouseover events in selenium web driver, To perform mouseover operation in selenium web driver we will use the Actions class. Actions class in selenium.

Testcase scenario

  • Open URL “”.
  • Perform mouseover operation on “Automation” in the menu.
  • Click on selenium web driver submenu under the menu tab.

Action class in selenium web driver with an example.

package testCases;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;


import org.openqa.selenium.interactions.Actions;



public class ActionClassExamples {

public static WebDriver driver;


* ................Task description............... URL=

* Mouseover at Selenium in the menu. Click on katalon Studio. Selenium=>Katalon

* studio.


public static void main(String[] args) {

// Set the system property.

System.setProperty("", "D:\Automation\chromedriver_win32\chromedriver.exe");

// Create an instance of Chrome driver.

driver = new ChromeDriver();

// Load URL.


WebDriverWait wait = new WebDriverWait(driver, 60);

// Wait until driver is not locate the path of "Selenium".


// Get the elements is the variable to make the task easy.

WebElement seleniumTab = driver.findElement(By.xpath("//*[@id='menu-item-1368']/a"));

WebElement KatalonStudioTab = driver.findElement(By.xpath("//*[@id='menu-item-1196']/a"));

// Create an object of Actions class and pass the driver as parameter.

Actions act = new Actions(driver);

// mouse over to the seleniumTab.


// Wait to load Katalon studio in sub menu.


// Click to the Katalon studio.






Add a Comment

Your email address will not be published.

seven + 13 =