Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

Menu &Sub-Menu’s Selenium Java

package com.example.actions;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;

public class ActionsExample {

WebDriver driver;

public void setup(){

driver=new FirefoxDriver();

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

driver.get("http://www.telanganatourism.gov.in/");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

}

public void menuandSubMenu(){

//root element
WebElement mainMenu=driver.findElement(By.xpath(".//*[@id='menuPracticalGuide']"));
Actions  action=new Actions(driver);
//movetoElemet which means mouseroVer action
action.moveToElement(mainMenu).build().perform();

}

public static void main(String[] args) {

ActionsExample actionexample=new ActionsExample();
actionexample.setup();
actionexample.menuandSubMenu();
}

}

Post a Comment

0 Comments