Interface BrowserTab

  • All Superinterfaces:
    AutoCloseable

    @Unstable
    public interface BrowserTab
    extends AutoCloseable
    Represents a web browser tab.
    Since:
    14.8
    Version:
    $Id: c972e996ed6adb1605814adbd30bb68514f9511f $
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void close()  
      String getSource()  
      default boolean navigate​(URL url)
      Navigates to the specified web page, without waiting for it to be fully loaded.
      default boolean navigate​(URL url, boolean wait)
      Navigates to the specified web page, optionally waiting for it to be ready (fully loaded).
      default boolean navigate​(URL url, javax.servlet.http.Cookie[] cookies, boolean wait)
      Navigates to the specified web page, optionally waiting for it to be ready (fully loaded).
      boolean navigate​(URL url, javax.servlet.http.Cookie[] cookies, boolean wait, int timeout)
      Navigates to the specified web page, optionally waiting for it to be ready (fully loaded).
      InputStream printToPDF​(Runnable cleanup)
      Print the current web page to PDF.
    • Method Detail

      • navigate

        boolean navigate​(URL url,
                         javax.servlet.http.Cookie[] cookies,
                         boolean wait,
                         int timeout)
                  throws IOException
        Navigates to the specified web page, optionally waiting for it to be ready (fully loaded).
        Parameters:
        url - the URL of the web page we are going to navigate to
        cookies - the cookies to use when loading the specified web page
        wait - true to wait for the page to be ready, false otherwise
        timeout - the number of seconds to wait for the web page to be ready before timing out
        Returns:
        true if the navigation was successful, false otherwise
        Throws:
        IOException - if navigating to the specified web page fails
        Since:
        14.9
      • navigate

        default boolean navigate​(URL url,
                                 javax.servlet.http.Cookie[] cookies,
                                 boolean wait)
                          throws IOException
        Navigates to the specified web page, optionally waiting for it to be ready (fully loaded).
        Parameters:
        url - the URL of the web page we are going to navigate to
        cookies - the cookies to use when loading the specified web page
        wait - true to wait for the page to be ready, false otherwise
        Returns:
        true if the navigation was successful, false otherwise
        Throws:
        IOException - if navigating to the specified web page fails
      • navigate

        default boolean navigate​(URL url,
                                 boolean wait)
                          throws IOException
        Navigates to the specified web page, optionally waiting for it to be ready (fully loaded).
        Parameters:
        url - the URL of the web page we are going to navigate to
        wait - true to wait for the page to be ready, false otherwise
        Returns:
        true if the navigation was successful, false otherwise
        Throws:
        IOException - if navigating to the specified web page fails
      • navigate

        default boolean navigate​(URL url)
                          throws IOException
        Navigates to the specified web page, without waiting for it to be fully loaded.
        Parameters:
        url - the URL of the web page we are going to navigate to
        Returns:
        true if the navigation was successful, false otherwise
        Throws:
        IOException - if navigating to the specified web page fails
      • getSource

        String getSource()
        Returns:
        the source of the web page loaded in this browser tab
        Since:
        14.10
      • printToPDF

        InputStream printToPDF​(Runnable cleanup)
        Print the current web page to PDF.
        Parameters:
        cleanup - the code to execute after the PDF was generated, useful for performing cleanup
        Returns:
        the PDF input stream