- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to perform mouseover action on an element in Selenium?
We can perform mouseover action on elements in Selenium with the help of Actions class. In order to perform the mouse movement we will use moveToElement () method of the Actions class. Finally use build().perform() to execute all the steps.
Example
import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Action; import org.openqa.selenium.interactions.Actions; import java.util.concurrent.TimeUnit; public class MouseOver{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://www.tutorialspoint.com/questions/index.php"; driver.get(url); driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS); // actions class with moveToElement() method for mouse hover to element Actions a = new Actions(driver); a.moveToElement(driver.findElement(By.xpath(“input[@type=’text’]))). build().perform(); driver.quit(); } }
- Related Articles
- How to perform scrolling action on page in Selenium?
- How to perform mouseover function in Selenium WebDriver using Java?
- How to perform double click on an element in Selenium?
- How to perform right click on an element with Actions in Selenium?
- How to perform double click on an element in Selenium with python?
- How to perform right click on an element in Selenium with python?
- How to perform releasing a mouse on an element in Selenium with python?
- How to perform mouse movement to an element in Selenium with python?
- How to perform a specified action on each element of the List in C#?
- How can I perform mouse hover action in Selenium-Python?
- How to verify if an element is displayed on screen in Selenium?
- How to click on hidden element in Selenium WebDriver?
- How to perform element-wise addition on tensors in PyTorch?
- How to perform element-wise subtraction on tensors in PyTorch?
- How to perform element-wise multiplication on tensors in PyTorch?

Advertisements