Package org.xwiki.export.pdf.browser
Interface BrowserTab
-
- All Superinterfaces:
AutoCloseable
@Unstable public interface BrowserTab extends AutoCloseable
Represents a web browser tab.- Since:
- 14.8
- Version:
- $Id: 00c2821160e60dcbd6889e2b7ad8636701134e73 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()StringgetSource()default booleannavigate(URL url)Navigates to the specified web page, without waiting for it to be fully loaded.default booleannavigate(URL url, boolean wait)Navigates to the specified web page, optionally waiting for it to be ready (fully loaded).default booleannavigate(URL url, javax.servlet.http.Cookie[] cookies, boolean wait)Navigates to the specified web page, optionally waiting for it to be ready (fully loaded).booleannavigate(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).InputStreamprintToPDF(Runnable cleanup)Print the current web page to PDF.voidsetBaseURL(URL baseURL)Sets the base URL for the currently loaded web page.
-
-
-
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 tocookies- the cookies to use when loading the specified web pagewait-trueto wait for the page to be ready,falseotherwisetimeout- the number of seconds to wait for the web page to be ready before timing out- Returns:
trueif the navigation was successful,falseotherwise- 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 tocookies- the cookies to use when loading the specified web pagewait-trueto wait for the page to be ready,falseotherwise- Returns:
trueif the navigation was successful,falseotherwise- 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 towait-trueto wait for the page to be ready,falseotherwise- Returns:
trueif the navigation was successful,falseotherwise- 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:
trueif the navigation was successful,falseotherwise- 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
-
setBaseURL
void setBaseURL(URL baseURL) throws IOException
Sets the base URL for the currently loaded web page.- Parameters:
baseURL- the base URL to set- Throws:
IOException
-
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
-
close
void close()
- Specified by:
closein interfaceAutoCloseable
-
-