How can I use Actions class in a POM class?

I have 2 pages. First one is home page and when I hover over one of the elements on it, it shows a drop down list. I have to click on one of the elements of the list which will take me to the 2nd page.
I am not able to use Actions class in Page Object Model class for the 1st i.e. HomePage.
Can anyone please help me with examples of a POM class with Actions class implementation?

Default Asked on February 6, 2015 in Selenium WebDriver.
Add Comment
  • 1 Answer(s)

    try this:

    public class POM{

       WebDriver driver;

       public POM(WebDriver driver){

          this.driver = driver;


       WebElement firstElement = driver.findElement(By.xpath(“//*[@id=’xxx’]”));

       WebElement listElement = driver.findElement(By.xpath(“//*[@id=’yyy’]”));

       public void clickListElement(){

        Actions action = new Actions(driver);






    Train Answered on February 19, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.