Mouse Over in Selenium
// Path of chrome exe (it is for my local u can give ur
local path)
System.setProperty("webdriver.chrome.driver",
"E:/My Workspace/Chrome_Path//chromedriver.exe");
// To launch a Chrome Driver
WebDriver driver = new ChromeDriver();
//To opens a website
driver.get("https://www.flipkart.com/");
// Implicit wait to wait for 15 seconds until page loads
driver.manage().timeouts().implicitlyWait(15,TimeUnit.SECONDS);
//path of the element where we want to perform mouse over
WebElement wb = driver.findElement(By.xpath("html/body/div[1]/div/header/div[2]/div/ul/li[1]/a"));
//To perform mouse over we need action class and argument
will be driver, below we are creating object of action //class
Actions act = new Actions(driver);
//Below we are performing mouse over
act.moveToElement(wb).perform();
Comments
Post a Comment