# Selenium owner methods

```
public class Browser {
    private static WebDriver driver;
    public static Actions mouse;
    public static WebDriverWait wait;

    public static void launch(String name) {
        if (name.equalsIgnoreCase("chrome")) {
            WebDriverManager.chromedriver().setup();
            driver = new ChromeDriver();
        } else if (name.equalsIgnoreCase("firefox")) {
            WebDriverManager.firefoxdriver().setup();
            driver = new FirefoxDriver();
        } else if (name.equalsIgnoreCase("ie")) {
            WebDriverManager.iedriver().setup();
            driver = new InternetExplorerDriver();
        }
        mouse = new Actions(getDriver());
        wait = new WebDriverWait(getDriver(), 30);
    }

    public static WebDriver getDriver() {
        return driver;
    }

    public static void visit(String url) {
        driver.get(url);
    }

    public static void fill(By locator, String withText) {
        driver.findElement(locator).clear();
        driver.findElement(locator).sendKeys(withText);
    }

    public static WebElement find(By locator) {
        return driver.findElement(locator);
    }

    public static void click(By locator) {
        driver.findElement(locator).click();
    }

    public static String getText(By locator) {
        return driver.findElement(locator).getText();
    }

    public static boolean isDisplayed(By locator) {
        return driver.findElement(locator).isDisplayed();
    }

    public static void hover(By locator) {
        mouse.moveToElement(find(locator)).perform();
    }

    public static List<WebElement> all(By locator) {
        return driver.findElements(locator);
    }

    public static int count(By locator) {
        return all(locator).size();
    }

    void check(By checkbox) {
        if (!find(checkbox).isSelected()) {
            click(checkbox);
        }
    }

    void uncheck(By checkbox) {
        if (find(checkbox).isSelected()) {
            click(checkbox);
        }
    }

}
```


---

# 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/owner-methods/selenium-owner-methods.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.
