✔ Mouse Hover WebElements via Selenium Actions Class | (Video 64)

Published: 12 September 2019
on channel: Rex Jones II
1,387
12

Selenium has the ability to hover a WebElement using the moveToElement method via Actions class. Main Menus containing sub-menus are perfect for a hovering action. If we need to interact with a WebElement within the sub-menu then we first hover the main menu. An ElementNotVisibleException shows up when overlooking the moveToElement method. This video hovers Amazon’s https://www.amazon.com/ Account & List drop down then click the Account WebElement.

► Download Transcript and Code https://www.rexjones2.com/selenium-mo...
► Documentation via GitHub https://github.com/RexJonesII/Free-Vi...

► Free Selenium PDF Book: https://www.rexjones2.com/book-seleni...
► Free Java PDF Book: https://www.rexjones2.com/book-part-1...
► All Paperback & eBooks: http://tinyurl.com/Rex-Allen-Jones-Books

► Connect With Me via LinkedIn   / rexjones34  
► Subscribe To This Channel https://www.youtube.com/c/RexJonesII?...

► Transcript
Hello and Welcome. In this video, we are going to automate moving the mouse to hover over a WebElement. Selenium’s Action class will help us move the mouse then perform an action. The Test Script will hover Hello, Sign In Account & List, select Your Account then get the page title. Inspect the element and we see nav-link-accountList as the id value. Copy the value.

Go to Eclipse and load the AUT driver.get("https://www.amazon.com/"); Next, we find the element WebElement menuSignIn = driver.findElement(By.id("nav-link-accountList"));
Actions class act = new Actions (driver); Import the classes.
act dot then we move to the element by selecting moveToElement. Which element? menuSignIn then perform.

Go back to Amazon and Inspect Your Account. Let’s find this value using XPath text function: //span[text()='Your Account'] Bingo. Copy the value.

Go back to Eclipse. driver.findElement(By.xpath("//span[text()='Your Account']")).click(); The last statement will get and print the page title. sysout System.out.println("Title = " + driver.getTitle());
Let’s Run. The Title is Your Account. That’s it and Thank You for watching how to automate moving the mouse over an element.

#MouseHover #SeleniumActions #BeginnerSeleniumTutorials #SeleniumWebDriver


Watch video ✔ Mouse Hover WebElements via Selenium Actions Class | (Video 64) online without registration, duration hours minute second in high quality. This video was added by user Rex Jones II 12 September 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,387 once and liked it 12 people.