Interface Page

All Known Implementing Classes:
PageImpl

public interface Page
Actions and events related to the inspected page belong to the page domain
  • Method Summary

    Modifier and Type Method Description
    void addCompilationCache​(java.lang.String url, java.lang.String data)
    Seeds compilation cache for given url.
    java.lang.String addScriptToEvaluateOnLoad​(java.lang.String scriptSource)
    Deprecated, please use addScriptToEvaluateOnNewDocument instead.
    java.lang.String addScriptToEvaluateOnNewDocument​(java.lang.String source)
    Evaluates given script in every frame upon creation (before loading frame's scripts).
    java.lang.String addScriptToEvaluateOnNewDocument​(java.lang.String source, java.lang.String worldName)
    Evaluates given script in every frame upon creation (before loading frame's scripts).
    void bringToFront()
    Brings page to front (activates tab).
    byte[] captureScreenshot()
    Capture page screenshot.
    byte[] captureScreenshot​(ImageFormat format, java.lang.Integer quality, Viewport clip, java.lang.Boolean fromSurface)
    Capture page screenshot.
    byte[] captureSnapshot()
    Returns a snapshot of the page as a string.
    byte[] captureSnapshot​(SnapshotType format)
    Returns a snapshot of the page as a string.
    void clearCompilationCache()
    Clears seeded compilation cache.
    void clearDeviceMetricsOverride()
    Clears the overriden device metrics.
    void clearDeviceOrientationOverride()
    Clears the overridden Device Orientation.
    void clearGeolocationOverride()
    Clears the overriden Geolocation Position and Error.
    void close()
    Tries to close page, running its beforeunload hooks, if any.
    void crash()
    Crashes renderer on the IO thread, generates minidumps.
    java.lang.Integer createIsolatedWorld​(java.lang.String frameId)
    Creates an isolated world for the given frame.
    java.lang.Integer createIsolatedWorld​(java.lang.String frameId, java.lang.String worldName, java.lang.Boolean grantUniveralAccess)
    Creates an isolated world for the given frame.
    void deleteCookie​(java.lang.String cookieName, java.lang.String url)
    Deletes browser cookie with given name, domain and path.
    void disable()
    Disables page domain notifications.
    void enable()
    Enables page domain notifications.
    void generateTestReport​(java.lang.String message)
    Generates a report for testing.
    void generateTestReport​(java.lang.String message, java.lang.String group)
    Generates a report for testing.
    GetAppManifestResult getAppManifest()  
    java.util.List<Cookie> getCookies()
    Returns all browser cookies.
    FrameTree getFrameTree()
    Returns present frame tree structure.
    java.util.List<java.lang.String> getInstallabilityErrors()  
    GetLayoutMetricsResult getLayoutMetrics()
    Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
    java.lang.String getManifestIcons()  
    GetNavigationHistoryResult getNavigationHistory()
    Returns navigation history for the current page.
    GetResourceContentResult getResourceContent​(java.lang.String frameId, java.lang.String url)
    Returns content of the given resource.
    FrameResourceTree getResourceTree()
    Returns present frame / resource tree structure.
    void handleJavaScriptDialog​(java.lang.Boolean accept)
    Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
    void handleJavaScriptDialog​(java.lang.Boolean accept, java.lang.String promptText)
    Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
    NavigateResult navigate​(java.lang.String url)
    Navigates current page to the given URL.
    NavigateResult navigate​(java.lang.String url, java.lang.String referrer, TransitionType transitionType, java.lang.String frameId)
    Navigates current page to the given URL.
    void navigateToHistoryEntry​(java.lang.Integer entryId)
    Navigates current page to the given history entry.
    PrintToPDFResult printToPDF()
    Print page as PDF.
    PrintToPDFResult printToPDF​(java.lang.Boolean landscape, java.lang.Boolean displayHeaderFooter, java.lang.Boolean printBackground, java.lang.Double scale, java.lang.Double paperWidth, java.lang.Double paperHeight, java.lang.Double marginTop, java.lang.Double marginBottom, java.lang.Double marginLeft, java.lang.Double marginRight, java.lang.String pageRanges, java.lang.Boolean ignoreInvalidPageRanges, java.lang.String headerTemplate, java.lang.String footerTemplate, java.lang.Boolean preferCSSPageSize, PdfTransferMode transferMode)
    Print page as PDF.
    void reload()
    Reloads given page optionally ignoring the cache.
    void reload​(java.lang.Boolean ignoreCache, java.lang.String scriptToEvaluateOnLoad)
    Reloads given page optionally ignoring the cache.
    void removeScriptToEvaluateOnLoad​(java.lang.String identifier)
    Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
    void removeScriptToEvaluateOnNewDocument​(java.lang.String identifier)
    Removes given script from the list.
    void resetNavigationHistory()
    Resets navigation history for the current page.
    void screencastFrameAck​(java.lang.Integer sessionId)
    Acknowledges that a screencast frame has been received by the frontend.
    java.util.List<SearchMatch> searchInResource​(java.lang.String frameId, java.lang.String url, java.lang.String query)
    Searches for given string in resource content.
    java.util.List<SearchMatch> searchInResource​(java.lang.String frameId, java.lang.String url, java.lang.String query, java.lang.Boolean caseSensitive, java.lang.Boolean isRegex)
    Searches for given string in resource content.
    void setAdBlockingEnabled​(java.lang.Boolean enabled)
    Enable Chrome's experimental ad filter on all sites.
    void setBypassCSP​(java.lang.Boolean enabled)
    Enable page Content Security Policy by-passing.
    void setDeviceMetricsOverride​(java.lang.Integer width, java.lang.Integer height, java.lang.Double deviceScaleFactor, java.lang.Boolean mobile)
    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​(java.lang.Integer width, java.lang.Integer height, java.lang.Double deviceScaleFactor, java.lang.Boolean mobile, java.lang.Double scale, java.lang.Integer screenWidth, java.lang.Integer screenHeight, java.lang.Integer positionX, java.lang.Integer positionY, java.lang.Boolean dontSetVisibleSize, ScreenOrientation screenOrientation, Viewport viewport)
    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​(java.lang.Double alpha, java.lang.Double beta, java.lang.Double gamma)
    Overrides the Device Orientation.
    void setDocumentContent​(java.lang.String frameId, java.lang.String html)
    Sets given markup as the document's HTML.
    void setDownloadBehavior​(DownloadBehavior behavior)
    Set the behavior when downloading a file.
    void setDownloadBehavior​(DownloadBehavior behavior, java.lang.String downloadPath)
    Set the behavior when downloading a file.
    void setFontFamilies​(FontFamilies fontFamilies)
    Set generic font families.
    void setFontSizes​(FontSizes fontSizes)
    Set default font sizes.
    void setGeolocationOverride()
    Overrides the Geolocation Position or Error.
    void setGeolocationOverride​(java.lang.Double latitude, java.lang.Double longitude, java.lang.Double accuracy)
    Overrides the Geolocation Position or Error.
    void setInterceptFileChooserDialog​(java.lang.Boolean enabled)
    Intercept file chooser requests and transfer control to protocol clients.
    void setLifecycleEventsEnabled​(java.lang.Boolean enabled)
    Controls whether page will emit lifecycle events.
    void setProduceCompilationCache​(java.lang.Boolean enabled)
    Forces compilation cache to be generated for every subresource script.
    void setTouchEmulationEnabled​(java.lang.Boolean enabled)
    Toggles mouse event-based touch event emulation.
    void setTouchEmulationEnabled​(java.lang.Boolean enabled, Platform configuration)
    Toggles mouse event-based touch event emulation.
    void setWebLifecycleState​(TargetLifecycleState state)
    Tries to update the web lifecycle state of the page.
    void startScreencast()
    Starts sending each frame using the `screencastFrame` event.
    void startScreencast​(ImageFormat format, java.lang.Integer quality, java.lang.Integer maxWidth, java.lang.Integer maxHeight, java.lang.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 waitForDebugger()
    Pauses page execution.
  • Method Details

    • addScriptToEvaluateOnLoad

      java.lang.String addScriptToEvaluateOnLoad​(java.lang.String scriptSource)
      Deprecated, please use addScriptToEvaluateOnNewDocument instead.
      Returns:
      Identifier of the added script.
    • addScriptToEvaluateOnNewDocument

      java.lang.String addScriptToEvaluateOnNewDocument​(java.lang.String source, java.lang.String worldName)
      Evaluates given script in every frame upon creation (before loading frame's scripts).
      Parameters:
      worldName - If specified, creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted.
      Returns:
      Identifier of the added script.
    • bringToFront

      void bringToFront()
      Brings page to front (activates tab).
    • captureScreenshot

      byte[] captureScreenshot​(ImageFormat format, java.lang.Integer quality, Viewport clip, java.lang.Boolean fromSurface)
      Capture page screenshot.
      Parameters:
      format - Image compression format (defaults to png).
      quality - Compression quality from range [0..100] (jpeg only).
      clip - Capture the screenshot of a given region only.
      fromSurface - Capture the screenshot from the surface, rather than the view. Defaults to true.
      Returns:
      Base64-encoded image data.
    • captureSnapshot

      byte[] captureSnapshot​(SnapshotType format)
      Returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles.
      Parameters:
      format - Format (defaults to mhtml).
      Returns:
      Serialized page data.
    • clearDeviceMetricsOverride

      void clearDeviceMetricsOverride()
      Clears the overriden device metrics.
    • clearDeviceOrientationOverride

      void clearDeviceOrientationOverride()
      Clears the overridden Device Orientation.
    • clearGeolocationOverride

      void clearGeolocationOverride()
      Clears the overriden Geolocation Position and Error.
    • createIsolatedWorld

      java.lang.Integer createIsolatedWorld​(java.lang.String frameId, java.lang.String worldName, java.lang.Boolean grantUniveralAccess)
      Creates an isolated world for the given frame.
      Parameters:
      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.
      Returns:
      Execution context of the isolated world.
    • deleteCookie

      void deleteCookie​(java.lang.String cookieName, java.lang.String url)
      Deletes browser cookie with given name, domain and path.
      Parameters:
      cookieName - Name of the cookie to remove.
      url - URL to match cooke domain and path.
    • disable

      void disable()
      Disables page domain notifications.
    • enable

      void enable()
      Enables page domain notifications.
    • getAppManifest

      GetAppManifestResult getAppManifest()
      Returns:
      GetAppManifestResult
    • getInstallabilityErrors

      java.util.List<java.lang.String> getInstallabilityErrors()
    • getManifestIcons

      java.lang.String getManifestIcons()
    • getCookies

      java.util.List<Cookie> getCookies()
      Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the `cookies` field.
      Returns:
      Array of cookie objects.
    • getFrameTree

      FrameTree getFrameTree()
      Returns present frame tree structure.
      Returns:
      Present frame tree structure.
    • getLayoutMetrics

      GetLayoutMetricsResult getLayoutMetrics()
      Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
      Returns:
      GetLayoutMetricsResult
    • getNavigationHistory

      GetNavigationHistoryResult getNavigationHistory()
      Returns navigation history for the current page.
      Returns:
      GetNavigationHistoryResult
    • resetNavigationHistory

      void resetNavigationHistory()
      Resets navigation history for the current page.
    • getResourceContent

      GetResourceContentResult getResourceContent​(java.lang.String frameId, java.lang.String url)
      Returns content of the given resource.
      Parameters:
      frameId - Frame id to get resource for.
      url - URL of the resource to get content for.
      Returns:
      GetResourceContentResult
    • getResourceTree

      FrameResourceTree getResourceTree()
      Returns present frame / resource tree structure.
      Returns:
      Present frame / resource tree structure.
    • handleJavaScriptDialog

      void handleJavaScriptDialog​(java.lang.Boolean accept, java.lang.String promptText)
      Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
      Parameters:
      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.
    • navigate

      NavigateResult navigate​(java.lang.String url, java.lang.String referrer, TransitionType transitionType, java.lang.String frameId)
      Navigates current page to the given URL.
      Parameters:
      url - URL to navigate the page to.
      referrer - Referrer URL.
      transitionType - Intended transition type.
      frameId - Frame id to navigate, if not specified navigates the top frame.
      Returns:
      NavigateResult
    • navigateToHistoryEntry

      void navigateToHistoryEntry​(java.lang.Integer entryId)
      Navigates current page to the given history entry.
      Parameters:
      entryId - Unique id of the entry to navigate to.
    • printToPDF

      PrintToPDFResult printToPDF​(java.lang.Boolean landscape, java.lang.Boolean displayHeaderFooter, java.lang.Boolean printBackground, java.lang.Double scale, java.lang.Double paperWidth, java.lang.Double paperHeight, java.lang.Double marginTop, java.lang.Double marginBottom, java.lang.Double marginLeft, java.lang.Double marginRight, java.lang.String pageRanges, java.lang.Boolean ignoreInvalidPageRanges, java.lang.String headerTemplate, java.lang.String footerTemplate, java.lang.Boolean preferCSSPageSize, PdfTransferMode transferMode)
      Print page as PDF.
      Parameters:
      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.
      ignoreInvalidPageRanges - Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. Defaults to false.
      headerTemplate - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: - `date`: formatted print date - `title`: document title - `url`: document location - `pageNumber`: current page number - `totalPages`: total pages in the document For example, `` would generate span containing the title.
      footerTemplate - HTML template for the print footer. Should use the same format as the `headerTemplate`.
      preferCSSPageSize - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
      transferMode - return as stream
      Returns:
      PrintToPDFResult
    • reload

      void reload​(java.lang.Boolean ignoreCache, java.lang.String scriptToEvaluateOnLoad)
      Reloads given page optionally ignoring the cache.
      Parameters:
      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. Argument will be ignored if reloading dataURL origin.
    • removeScriptToEvaluateOnLoad

      void removeScriptToEvaluateOnLoad​(java.lang.String identifier)
      Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
    • removeScriptToEvaluateOnNewDocument

      void removeScriptToEvaluateOnNewDocument​(java.lang.String identifier)
      Removes given script from the list.
    • screencastFrameAck

      void screencastFrameAck​(java.lang.Integer sessionId)
      Acknowledges that a screencast frame has been received by the frontend.
      Parameters:
      sessionId - Frame number.
    • searchInResource

      java.util.List<SearchMatch> searchInResource​(java.lang.String frameId, java.lang.String url, java.lang.String query, java.lang.Boolean caseSensitive, java.lang.Boolean isRegex)
      Searches for given string in resource content.
      Parameters:
      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.
      Returns:
      List of search matches.
    • setAdBlockingEnabled

      void setAdBlockingEnabled​(java.lang.Boolean enabled)
      Enable Chrome's experimental ad filter on all sites.
      Parameters:
      enabled - Whether to block ads.
    • setBypassCSP

      void setBypassCSP​(java.lang.Boolean enabled)
      Enable page Content Security Policy by-passing.
      Parameters:
      enabled - Whether to bypass page CSP.
    • setDeviceMetricsOverride

      void setDeviceMetricsOverride​(java.lang.Integer width, java.lang.Integer height, java.lang.Double deviceScaleFactor, java.lang.Boolean mobile, java.lang.Double scale, java.lang.Integer screenWidth, java.lang.Integer screenHeight, java.lang.Integer positionX, java.lang.Integer positionY, java.lang.Boolean dontSetVisibleSize, ScreenOrientation screenOrientation, Viewport viewport)
      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).
      Parameters:
      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.
      scale - Scale to apply to resulting view image.
      screenWidth - Overriding screen width value in pixels (minimum 0, maximum 10000000).
      screenHeight - Overriding screen height value in pixels (minimum 0, maximum 10000000).
      positionX - Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
      positionY - Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
      dontSetVisibleSize - Do not set visible view size, rely upon explicit setVisibleSize call.
      screenOrientation - Screen orientation override.
      viewport - The viewport dimensions and scale. If not set, the override is cleared.
    • setDeviceOrientationOverride

      void setDeviceOrientationOverride​(java.lang.Double alpha, java.lang.Double beta, java.lang.Double gamma)
      Overrides the Device Orientation.
      Parameters:
      alpha - Mock alpha
      beta - Mock beta
      gamma - Mock gamma
    • setFontFamilies

      void setFontFamilies​(FontFamilies fontFamilies)
      Set generic font families.
      Parameters:
      fontFamilies - Specifies font families to set. If a font family is not specified, it won't be changed.
    • setFontSizes

      void setFontSizes​(FontSizes fontSizes)
      Set default font sizes.
      Parameters:
      fontSizes - Specifies font sizes to set. If a font size is not specified, it won't be changed.
    • setDocumentContent

      void setDocumentContent​(java.lang.String frameId, java.lang.String html)
      Sets given markup as the document's HTML.
      Parameters:
      frameId - Frame id to set HTML for.
      html - HTML content to set.
    • setDownloadBehavior

      void setDownloadBehavior​(DownloadBehavior behavior, java.lang.String downloadPath)
      Set the behavior when downloading a file.
      Parameters:
      behavior - Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
      downloadPath - The default path to save downloaded files to. This is requred if behavior is set to 'allow'
    • setGeolocationOverride

      void setGeolocationOverride​(java.lang.Double latitude, java.lang.Double longitude, java.lang.Double accuracy)
      Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
      Parameters:
      latitude - Mock latitude
      longitude - Mock longitude
      accuracy - Mock accuracy
    • setLifecycleEventsEnabled

      void setLifecycleEventsEnabled​(java.lang.Boolean enabled)
      Controls whether page will emit lifecycle events.
      Parameters:
      enabled - If true, starts emitting lifecycle events.
    • setTouchEmulationEnabled

      void setTouchEmulationEnabled​(java.lang.Boolean enabled, Platform configuration)
      Toggles mouse event-based touch event emulation.
      Parameters:
      enabled - Whether the touch event emulation should be enabled.
      configuration - Touch/gesture events configuration. Default: current platform.
    • startScreencast

      void startScreencast​(ImageFormat format, java.lang.Integer quality, java.lang.Integer maxWidth, java.lang.Integer maxHeight, java.lang.Integer everyNthFrame)
      Starts sending each frame using the `screencastFrame` event.
      Parameters:
      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.
    • stopLoading

      void stopLoading()
      Force the page stop all navigations and pending resource fetches.
    • crash

      void crash()
      Crashes renderer on the IO thread, generates minidumps.
    • close

      void close()
      Tries to close page, running its beforeunload hooks, if any.
    • setWebLifecycleState

      void setWebLifecycleState​(TargetLifecycleState state)
      Tries to update the web lifecycle state of the page. It will transition the page to the given state according to: https://github.com/WICG/web-lifecycle/
      Parameters:
      state - Target lifecycle state
    • stopScreencast

      void stopScreencast()
      Stops sending each frame in the `screencastFrame`.
    • setProduceCompilationCache

      void setProduceCompilationCache​(java.lang.Boolean enabled)
      Forces compilation cache to be generated for every subresource script.
    • addCompilationCache

      void addCompilationCache​(java.lang.String url, java.lang.String data)
      Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation.
      Parameters:
      data - Base64-encoded data
    • clearCompilationCache

      void clearCompilationCache()
      Clears seeded compilation cache.
    • generateTestReport

      void generateTestReport​(java.lang.String message, java.lang.String group)
      Generates a report for testing.
      Parameters:
      message - Message to be displayed in the report.
      group - Specifies the endpoint group to deliver the report to.
    • waitForDebugger

      void waitForDebugger()
      Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.
    • setInterceptFileChooserDialog

      void setInterceptFileChooserDialog​(java.lang.Boolean enabled)
      Intercept file chooser requests and transfer control to protocol clients. When file chooser interception is enabled, native file chooser dialog is not shown. Instead, a protocol event `Page.fileChooserOpened` is emitted.
    • addScriptToEvaluateOnNewDocument

      java.lang.String addScriptToEvaluateOnNewDocument​(java.lang.String source)
      Evaluates given script in every frame upon creation (before loading frame's scripts).
      Returns:
      Identifier of the added script.
    • captureScreenshot

      byte[] captureScreenshot()
      Capture page screenshot.
      Returns:
      Base64-encoded image data.
    • captureSnapshot

      byte[] captureSnapshot()
      Returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles.
      Returns:
      Serialized page data.
    • createIsolatedWorld

      java.lang.Integer createIsolatedWorld​(java.lang.String frameId)
      Creates an isolated world for the given frame.
      Parameters:
      frameId - Id of the frame in which the isolated world should be created.
      Returns:
      Execution context of the isolated world.
    • handleJavaScriptDialog

      void handleJavaScriptDialog​(java.lang.Boolean accept)
      Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
      Parameters:
      accept - Whether to accept or dismiss the dialog.
    • navigate

      NavigateResult navigate​(java.lang.String url)
      Navigates current page to the given URL.
      Parameters:
      url - URL to navigate the page to.
      Returns:
      NavigateResult
    • printToPDF

      PrintToPDFResult printToPDF()
      Print page as PDF.
      Returns:
      PrintToPDFResult
    • reload

      void reload()
      Reloads given page optionally ignoring the cache.
    • searchInResource

      java.util.List<SearchMatch> searchInResource​(java.lang.String frameId, java.lang.String url, java.lang.String query)
      Searches for given string in resource content.
      Parameters:
      frameId - Frame id for resource to search in.
      url - URL of the resource to search in.
      query - String to search for.
      Returns:
      List of search matches.
    • setDeviceMetricsOverride

      void setDeviceMetricsOverride​(java.lang.Integer width, java.lang.Integer height, java.lang.Double deviceScaleFactor, java.lang.Boolean mobile)
      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).
      Parameters:
      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.
    • setDownloadBehavior

      void setDownloadBehavior​(DownloadBehavior behavior)
      Set the behavior when downloading a file.
      Parameters:
      behavior - Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
    • setGeolocationOverride

      void setGeolocationOverride()
      Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
    • setTouchEmulationEnabled

      void setTouchEmulationEnabled​(java.lang.Boolean enabled)
      Toggles mouse event-based touch event emulation.
      Parameters:
      enabled - Whether the touch event emulation should be enabled.
    • startScreencast

      void startScreencast()
      Starts sending each frame using the `screencastFrame` event.
    • generateTestReport

      void generateTestReport​(java.lang.String message)
      Generates a report for testing.
      Parameters:
      message - Message to be displayed in the report.