public interface Page
Modifier and Type | Method and Description |
---|---|
String |
addScriptToEvaluateOnLoad(String scriptSource) |
byte[] |
captureScreenshot()
Capture page screenshot.
|
byte[] |
captureScreenshot(ImageFormat format,
Integer quality,
Boolean fromSurface)
Capture page screenshot.
|
void |
clearDeviceMetricsOverride()
Clears the overriden device metrics.
|
void |
clearDeviceOrientationOverride()
Clears the overridden Device Orientation.
|
void |
clearGeolocationOverride()
Clears the overriden Geolocation Position and Error.
|
void |
createIsolatedWorld(String frameId)
Creates an isolated world for the given frame.
|
void |
createIsolatedWorld(String frameId,
String worldName,
Boolean grantUniveralAccess)
Creates an isolated world for the given frame.
|
void |
deleteCookie(String cookieName,
String url)
Deletes browser cookie with given name, domain and path.
|
void |
disable()
Disables page domain notifications.
|
void |
enable()
Enables page domain notifications.
|
GetAppManifestResult |
getAppManifest() |
List<Cookie> |
getCookies()
Returns all browser cookies.
|
GetLayoutMetricsResult |
getLayoutMetrics()
Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
|
GetNavigationHistoryResult |
getNavigationHistory()
Returns navigation history for the current page.
|
GetResourceContentResult |
getResourceContent(String frameId,
String url)
Returns content of the given resource.
|
FrameResourceTree |
getResourceTree()
Returns present frame / resource tree structure.
|
void |
handleJavaScriptDialog(Boolean accept)
Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
|
void |
handleJavaScriptDialog(Boolean accept,
String promptText)
Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
|
String |
navigate(String url)
Navigates current page to the given URL.
|
String |
navigate(String url,
String referrer,
TransitionType transitionType)
Navigates current page to the given URL.
|
void |
navigateToHistoryEntry(Integer entryId)
Navigates current page to the given history entry.
|
byte[] |
printToPDF()
Print page as PDF.
|
byte[] |
printToPDF(Boolean landscape,
Boolean displayHeaderFooter,
Boolean printBackground,
Double scale,
Double paperWidth,
Double paperHeight,
Double marginTop,
Double marginBottom,
Double marginLeft,
Double marginRight,
String pageRanges)
Print page as PDF.
|
void |
processNavigation(NavigationResponse response,
Integer navigationId)
Should be sent in response to a navigationRequested or a redirectRequested event, telling the browser how to handle the navigation.
|
void |
reload()
Reloads given page optionally ignoring the cache.
|
void |
reload(Boolean ignoreCache,
String scriptToEvaluateOnLoad)
Reloads given page optionally ignoring the cache.
|
void |
removeScriptToEvaluateOnLoad(String identifier) |
void |
requestAppBanner() |
void |
screencastFrameAck(Integer sessionId)
Acknowledges that a screencast frame has been received by the frontend.
|
List<SearchMatch> |
searchInResource(String frameId,
String url,
String query)
Searches for given string in resource content.
|
List<SearchMatch> |
searchInResource(String frameId,
String url,
String query,
Boolean caseSensitive,
Boolean isRegex)
Searches for given string in resource content.
|
void |
setAutoAttachToCreatedPages(Boolean autoAttach)
Controls whether browser will open a new inspector window for connected pages.
|
void |
setControlNavigations(Boolean enabled)
Toggles navigation throttling which allows programatic control over navigation and redirect response.
|
void |
setDeviceMetricsOverride(Integer width,
Integer height,
Double deviceScaleFactor,
Boolean mobile,
Boolean fitWindow)
Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).
|
void |
setDeviceMetricsOverride(Integer width,
Integer height,
Double deviceScaleFactor,
Boolean mobile,
Boolean fitWindow,
Double scale,
Double offsetX,
Double offsetY,
Integer screenWidth,
Integer screenHeight,
Integer positionX,
Integer positionY,
ScreenOrientation screenOrientation)
Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).
|
void |
setDeviceOrientationOverride(Double alpha,
Double beta,
Double gamma)
Overrides the Device Orientation.
|
void |
setDocumentContent(String frameId,
String html)
Sets given markup as the document's HTML.
|
void |
setGeolocationOverride()
Overrides the Geolocation Position or Error.
|
void |
setGeolocationOverride(Double latitude,
Double longitude,
Double accuracy)
Overrides the Geolocation Position or Error.
|
void |
setTouchEmulationEnabled(Boolean enabled)
Toggles mouse event-based touch event emulation.
|
void |
setTouchEmulationEnabled(Boolean enabled,
Platform configuration)
Toggles mouse event-based touch event emulation.
|
void |
startScreencast()
Starts sending each frame using the screencastFrame event.
|
void |
startScreencast(ImageFormat format,
Integer quality,
Integer maxWidth,
Integer maxHeight,
Integer everyNthFrame)
Starts sending each frame using the screencastFrame event.
|
void |
stopLoading()
Force the page stop all navigations and pending resource fetches.
|
void |
stopScreencast()
Stops sending each frame in the screencastFrame.
|
void enable()
void disable()
void removeScriptToEvaluateOnLoad(String identifier)
void setAutoAttachToCreatedPages(Boolean autoAttach)
autoAttach
- If true, browser will open a new inspector window for every page created from this one.void reload(Boolean ignoreCache, String scriptToEvaluateOnLoad)
ignoreCache
- If true, browser cache is ignored (as if the user pressed Shift+refresh).scriptToEvaluateOnLoad
- If set, the script will be injected into all frames of the inspected page after reload.String navigate(String url, String referrer, TransitionType transitionType)
url
- URL to navigate the page to.referrer
- Referrer URL.transitionType
- Intended transition type.void stopLoading()
GetNavigationHistoryResult getNavigationHistory()
void navigateToHistoryEntry(Integer entryId)
entryId
- Unique id of the entry to navigate to.List<Cookie> getCookies()
void deleteCookie(String cookieName, String url)
cookieName
- Name of the cookie to remove.url
- URL to match cooke domain and path.FrameResourceTree getResourceTree()
GetResourceContentResult getResourceContent(String frameId, String url)
frameId
- Frame id to get resource for.url
- URL of the resource to get content for.List<SearchMatch> searchInResource(String frameId, String url, String query, Boolean caseSensitive, Boolean isRegex)
frameId
- Frame id for resource to search in.url
- URL of the resource to search in.query
- String to search for.caseSensitive
- If true, search is case sensitive.isRegex
- If true, treats string parameter as regex.void setDocumentContent(String frameId, String html)
frameId
- Frame id to set HTML for.html
- HTML content to set.void setDeviceMetricsOverride(Integer width, Integer height, Double deviceScaleFactor, Boolean mobile, Boolean fitWindow, Double scale, Double offsetX, Double offsetY, Integer screenWidth, Integer screenHeight, Integer positionX, Integer positionY, ScreenOrientation screenOrientation)
width
- Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.height
- Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.deviceScaleFactor
- Overriding device scale factor value. 0 disables the override.mobile
- Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.fitWindow
- Whether a view that exceeds the available browser window area should be scaled down to fit.scale
- Scale to apply to resulting view image. Ignored in |fitWindow| mode.offsetX
- X offset to shift resulting view image by. Ignored in |fitWindow| mode.offsetY
- Y offset to shift resulting view image by. Ignored in |fitWindow| mode.screenWidth
- Overriding screen width value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.screenHeight
- Overriding screen height value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.positionX
- Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.positionY
- Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.screenOrientation
- Screen orientation override.void clearDeviceMetricsOverride()
void setGeolocationOverride(Double latitude, Double longitude, Double accuracy)
latitude
- Mock latitudelongitude
- Mock longitudeaccuracy
- Mock accuracyvoid clearGeolocationOverride()
void setDeviceOrientationOverride(Double alpha, Double beta, Double gamma)
alpha
- Mock alphabeta
- Mock betagamma
- Mock gammavoid clearDeviceOrientationOverride()
void setTouchEmulationEnabled(Boolean enabled, Platform configuration)
enabled
- Whether the touch event emulation should be enabled.configuration
- Touch/gesture events configuration. Default: current platform.byte[] captureScreenshot(ImageFormat format, Integer quality, Boolean fromSurface)
format
- Image compression format (defaults to png).quality
- Compression quality from range [0..100] (jpeg only).fromSurface
- Capture the screenshot from the surface, rather than the view. Defaults to true.byte[] printToPDF(Boolean landscape, Boolean displayHeaderFooter, Boolean printBackground, Double scale, Double paperWidth, Double paperHeight, Double marginTop, Double marginBottom, Double marginLeft, Double marginRight, String pageRanges)
landscape
- Paper orientation. Defaults to false.displayHeaderFooter
- Display header and footer. Defaults to false.printBackground
- Print background graphics. Defaults to false.scale
- Scale of the webpage rendering. Defaults to 1.paperWidth
- Paper width in inches. Defaults to 8.5 inches.paperHeight
- Paper height in inches. Defaults to 11 inches.marginTop
- Top margin in inches. Defaults to 1cm (~0.4 inches).marginBottom
- Bottom margin in inches. Defaults to 1cm (~0.4 inches).marginLeft
- Left margin in inches. Defaults to 1cm (~0.4 inches).marginRight
- Right margin in inches. Defaults to 1cm (~0.4 inches).pageRanges
- Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.void startScreencast(ImageFormat format, Integer quality, Integer maxWidth, Integer maxHeight, Integer everyNthFrame)
format
- Image compression format.quality
- Compression quality from range [0..100].maxWidth
- Maximum screenshot width.maxHeight
- Maximum screenshot height.everyNthFrame
- Send every n-th frame.void stopScreencast()
void screencastFrameAck(Integer sessionId)
sessionId
- Frame number.void handleJavaScriptDialog(Boolean accept, String promptText)
accept
- Whether to accept or dismiss the dialog.promptText
- The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.GetAppManifestResult getAppManifest()
void requestAppBanner()
void setControlNavigations(Boolean enabled)
void processNavigation(NavigationResponse response, Integer navigationId)
GetLayoutMetricsResult getLayoutMetrics()
void createIsolatedWorld(String frameId, String worldName, Boolean grantUniveralAccess)
frameId
- Id of the frame in which the isolated world should be created.worldName
- An optional name which is reported in the Execution Context.grantUniveralAccess
- Whether or not universal access should be granted to the isolated world. This is a powerful option, use with caution.void reload()
String navigate(String url)
url
- URL to navigate the page to.List<SearchMatch> searchInResource(String frameId, String url, String query)
frameId
- Frame id for resource to search in.url
- URL of the resource to search in.query
- String to search for.void setDeviceMetricsOverride(Integer width, Integer height, Double deviceScaleFactor, Boolean mobile, Boolean fitWindow)
width
- Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.height
- Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.deviceScaleFactor
- Overriding device scale factor value. 0 disables the override.mobile
- Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.fitWindow
- Whether a view that exceeds the available browser window area should be scaled down to fit.void setGeolocationOverride()
void setTouchEmulationEnabled(Boolean enabled)
enabled
- Whether the touch event emulation should be enabled.byte[] captureScreenshot()
byte[] printToPDF()
void startScreencast()
void handleJavaScriptDialog(Boolean accept)
accept
- Whether to accept or dismiss the dialog.void createIsolatedWorld(String frameId)
frameId
- Id of the frame in which the isolated world should be created.Copyright © 2017 WebFolder OÜ. All rights reserved.