How to work with mouse hover menu in selenium?

package wdProgram;


import java.util.concurrent.TimeUnit;

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.Actions;


public class HandleMouseOverEvent {


public static void main(String[] args) {


System.setProperty("webdriver.chrome.driver",

"D:\\Software\\Testing-Tools\\Selenium\\WebDriver\\Drivers\\IEChromeFirefox\\19092018\\chromedriver.exe");

WebDriver driver = new ChromeDriver();

driver.manage().window().maximize();

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

driver.get("https://www.amway.com/");

driver.findElement(By.xpath("//html/body/div[2]/table/tbody/tr[1]/td[2]/table/tbody/tr/td[3]/ul/li/a")).click();

WebElement mainMenu = driver.findElement(By.xpath("//*[@id=\"menu\"]/li[4]/a"));

WebElement subMenu = driver.findElement(By.xpath("//*[@id=\"menu\"]/li[4]/div/div[3]/div[2]/ul/li[5]/a"));


Actions act = new Actions(driver);

act.moveToElement(mainMenu).build().perform();

subMenu.click();

}


}

Comments

Popular posts from this blog

For Get Dynamic data & USe it into Postman Body parameters

API Automation Testing Script to check Response

Login through Data Driven Testing in selenium

Which dependencies needed in pom.xml while doing automation through selenium?

Download Java(JDK) & Eclipse IDE for selenium

What is data driven testing?

How to extract all the links in selenium?