Class WebDriver

    • Method Detail

      • get

        public void get​(java.lang.String url)
        Load a new web page in the current browser window.
        Specified by:
        get in interface WebDriver
        Parameters:
        url - The URL to load. It is best to use a fully qualified URL
      • switchTo

        public WebDriver.TargetLocator switchTo()
        Send future commands to a different frame or window.
        Specified by:
        switchTo in interface WebDriver
        Returns:
        A TargetLocator which can be used to select a frame or window
      • quit

        public void quit()
        Quits this driver, closing every associated window.
        Specified by:
        quit in interface WebDriver
      • getWindowHandles

        public java.util.Set<java.lang.String> getWindowHandles()
        Return a set of window handles which can be used to iterate over all open windows of this webdriver instance.
        Specified by:
        getWindowHandles in interface WebDriver
        Returns:
        A set of window handles which can be used to iterate over all open windows.
      • getWindowHandle

        public java.lang.String getWindowHandle()
        Return an opaque handle to this window that uniquely identifies it within this driver instance.
        Specified by:
        getWindowHandle in interface WebDriver
        Returns:
        An opaque handle to this window that uniquely identifies it within this driver instance.
      • getTitle

        public java.lang.String getTitle()
        The title of the current page.
        Specified by:
        getTitle in interface WebDriver
        Returns:
        The title of the current page
      • getPageSource

        public java.lang.String getPageSource()
        Get the source of the last loaded page.
        Specified by:
        getPageSource in interface WebDriver
        Returns:
        The source of the current page
      • getCurrentUrl

        public java.lang.String getCurrentUrl()
        Get a string representing the current URL that the browser is looking at.
        Specified by:
        getCurrentUrl in interface WebDriver
        Returns:
        The URL of the page currently loaded in the browser
      • findElements

        public java.util.List<WebElement> findElements​(By by)
        Find all elements within the current page using the given mechanism.
        Specified by:
        findElements in interface SearchContext
        Specified by:
        findElements in interface WebDriver
        Parameters:
        by - The locating mechanism to use
        Returns:
        A list of all WebElements, or an empty list if nothing matches
      • close

        public void close()
        Close the current window, quitting the browser if it's the last window currently open.
        Specified by:
        close in interface WebDriver
      • getDriverType

        public WebDriverType getDriverType()
        Get the driver type of this instance (e.g. FireFox, HtmlUnit)
        Returns:
        the driver type of this instance.