Selenium Java for mouse events using the Action class
KW.java
import org.openqa.selenium.By; 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; class KW { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "/home/kodingwindow/drivers/chromedriver"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.navigate().to("https://kodingwindow.com/testapp/"); WebElement link = driver.findElement(By.name("reset")); Actions builder = new Actions(driver); Action mouseHoverHome = builder.moveToElement(link).build(); mouseHoverHome.perform(); } }
Comments and Reactions
What Next?
Selenium Java to perform series of multiple actions using Action and Actions classes
Selenium Java to select an option from the Chrome context menu
Selenium Java to capture screenshots using Robot class
Advertisement