How to locate a link using page object model after mouse over

  • When I hover over login text there are list of links, i need to select Infostore using Page Object model approach. I am new to Selenium could any one help. I have the outer HTML for you:

    <div class="desktop-login">
         <ul class="no-bullet list-nav-child sub-menu-lv">
             <li class="nav-child-item">
                 <a href="">Infostore</a> 

    enter image description here

  • You can create classes like this,

    Your POM class something look like this:-

     public class Homepage{
      WebDriver driver;
      public Homepage(WebDriver driver) {
            this.driver = driver;
            private static final By loginLink= By.linkText("LOGIN");
            private static final By infostoreLink= By.linkText("Infostore");
          public void clickInfostoreLink() { 
              WebElement element= driver.findElement(loginLink);
              Actions action= new Actions(driver);

    Your Test class like this:-

    public class LoginTest extends BaseTest {
      public void infostoreTest() {
    Homepage add= new Homepage(driver);
    //Whatever you want to test according to your test case

    and BaseTest class look like this:-

    public class BaseTest { 
    public static WebDriver driver; 
      public void LaunchApplication() 
    System.setProperty("", "C:\\Intel\\chromedriver.exe");
          driver= new ChromeDriver();
      public void closeApplication()

    hope this will help you to get some idea about POM.

Suggested Topics