In this video will see how several mouse actions can be performed through Selenium. These mouse actions methods are defined in Actions() class. By using these class will perform all the mouse actions.
How to take web element xpath: https://www.youtube.com/watch?v=jPrphm-8njo&list=PLFfOLCbwIxbDCAFRkkvY4szs2HRS_FKaF&index=5
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Code:
public class VerifyPageLoad{
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "directory path of chrome driver exe\\chromedriver.exe");
ChromeOptions op = new ChromeOptions();
op.setBinary("directory path of chrome exe\\chrome.exe");
op.addArguments("--remote-allow-origins=*");
WebDriver driver = new ChromeDriver(op);
driver.get("https://programmerworld.co/");
WebElement rightClickElement = driver.findElement(By.xpath("//a[text()='programmerworld']"));
WebElement mouseHoverElement = driver.findElement(By.xpath("//a[text()='Blogs']"));
WebElement doubleClickElement = driver.findElement(By.xpath("//a[text()='Selenium']"));
Actions act = new Actions(driver);
//Right click code
act.contextClick(rightClickElement).perform();
//mousehover code
act.moveToElement(mouseHoverElement).perform();
//double click coe
act.doubleClick(doubleClickElement).perform();}
}
Excerpt:
In this video, you will learn how to perform various mouse actions using Selenium’s Actions() class. The mouse action methods are demonstrated in the context of web element xpath. Additionally, code is provided for a class named VerifyPageLoad, which includes examples of right-click, mouse hover, and double-click actions. The video links shared demonstrate practical implementation. For inquiries, suggestions, or feedback, you can reach out at Programmer World Contact or via email at programmerworld1990@gmail.com.