# 5.9. Hover

```java
public class HoverTest {
    WebDriver driver;
    Actions mouse;

    @BeforeClass
    void setUp() {
        driver = new ChromeDriver();
        driver.get("https://the-internet.herokuapp.com/hovers");
        mouse = new Actions(driver);
    }

    @DataProvider
    Object[][] avatar() {
        return new Object[][]{
                new Object[]{0, "name: user1"},
                new Object[]{1, "name: user2"},
                new Object[]{2, "name: user3"},
        };
    }

    @Test(dataProvider = "avatar")
    void avatarCaption(int personIndex, String caption) {
        WebElement person1 = driver.findElements(By.className("figure")).get(personIndex);
        mouse.moveToElement(person1).perform(); // --> hover

        WebElement person1Caption = person1
                .findElement(By.className("figcaption"))
                .findElement(By.tagName("h5"));

        Assert.assertEquals(person1Caption.getText(), caption);
    }

    @AfterClass
    void tearDown() {
        driver.quit();
    }
}
```

�


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tvn.gitbook.io/selenium-java/examples/hover.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
