how to click hover element in selenium code example

Example 1: python selenium hover over element

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Firefox()
driver.get('http://example.com')
element_to_hover_over = firefox.find_element_by_id("foo")

# actual hover
ActionChains(driver).move_to_element(element_to_hover_over).perform()

Example 2: how to hover mouse over an element in selenium

By using Actions class

WebElement element = driver.findElement(By.xpath("xpath"));
Actions action = new Actions(driver);
action.moveToElement(element).perform();

Tags:

Misc Example