Class PageImpl

java.lang.Object
io.webfolder.cdp.command.PageImpl
All Implemented Interfaces:
Page

public class PageImpl
extends java.lang.Object
implements Page
  • Constructor Summary

    Constructors 
    Constructor Description
    PageImpl​(SessionInvocationHandler handler)  
  • 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • addScriptToEvaluateOnLoad

      public java.lang.String addScriptToEvaluateOnLoad​(java.lang.String scriptSource)
      Description copied from interface: Page
      Deprecated, please use addScriptToEvaluateOnNewDocument instead.
      Specified by:
      addScriptToEvaluateOnLoad in interface Page
      Returns:
      Identifier of the added script.
    • addScriptToEvaluateOnNewDocument

      public java.lang.String addScriptToEvaluateOnNewDocument​(java.lang.String source, java.lang.String worldName)
      Description copied from interface: Page
      Evaluates given script in every frame upon creation (before loading frame's scripts).
      Specified by:
      addScriptToEvaluateOnNewDocument in interface Page
      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

      public void bringToFront()
      Description copied from interface: Page
      Brings page to front (activates tab).
      Specified by:
      bringToFront in interface Page
    • captureScreenshot

      public byte[] captureScreenshot​(ImageFormat format, java.lang.Integer quality, Viewport clip, java.lang.Boolean fromSurface)
      Description copied from interface: Page
      Capture page screenshot.
      Specified by:
      captureScreenshot in interface Page
      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

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

      public void clearDeviceMetricsOverride()
      Description copied from interface: Page
      Clears the overriden device metrics.
      Specified by:
      clearDeviceMetricsOverride in interface Page
    • clearDeviceOrientationOverride

      public void clearDeviceOrientationOverride()
      Description copied from interface: Page
      Clears the overridden Device Orientation.
      Specified by:
      clearDeviceOrientationOverride in interface Page
    • clearGeolocationOverride

      public void clearGeolocationOverride()
      Description copied from interface: Page
      Clears the overriden Geolocation Position and Error.
      Specified by:
      clearGeolocationOverride in interface Page
    • createIsolatedWorld

      public java.lang.Integer createIsolatedWorld​(java.lang.String frameId, java.lang.String worldName, java.lang.Boolean grantUniveralAccess)
      Description copied from interface: Page
      Creates an isolated world for the given frame.
      Specified by:
      createIsolatedWorld in interface Page
      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

      public void deleteCookie​(java.lang.String cookieName, java.lang.String url)
      Description copied from interface: Page
      Deletes browser cookie with given name, domain and path.
      Specified by:
      deleteCookie in interface Page
      Parameters:
      cookieName - Name of the cookie to remove.
      url - URL to match cooke domain and path.
    • disable

      public void disable()
      Description copied from interface: Page
      Disables page domain notifications.
      Specified by:
      disable in interface Page
    • enable

      public void enable()
      Description copied from interface: Page
      Enables page domain notifications.
      Specified by:
      enable in interface Page
    • getAppManifest

      public GetAppManifestResult getAppManifest()
      Specified by:
      getAppManifest in interface Page
      Returns:
      GetAppManifestResult
    • getInstallabilityErrors

      public java.util.List<java.lang.String> getInstallabilityErrors()
      Specified by:
      getInstallabilityErrors in interface Page
    • getManifestIcons

      public java.lang.String getManifestIcons()
      Specified by:
      getManifestIcons in interface Page
    • getCookies

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

      public FrameTree getFrameTree()
      Description copied from interface: Page
      Returns present frame tree structure.
      Specified by:
      getFrameTree in interface Page
      Returns:
      Present frame tree structure.
    • getLayoutMetrics

      public GetLayoutMetricsResult getLayoutMetrics()
      Description copied from interface: Page
      Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
      Specified by:
      getLayoutMetrics in interface Page
      Returns:
      GetLayoutMetricsResult
    • getNavigationHistory

      public GetNavigationHistoryResult getNavigationHistory()
      Description copied from interface: Page
      Returns navigation history for the current page.
      Specified by:
      getNavigationHistory in interface Page
      Returns:
      GetNavigationHistoryResult
    • resetNavigationHistory

      public void resetNavigationHistory()
      Description copied from interface: Page
      Resets navigation history for the current page.
      Specified by:
      resetNavigationHistory in interface Page
    • getResourceContent

      public GetResourceContentResult getResourceContent​(java.lang.String frameId, java.lang.String url)
      Description copied from interface: Page
      Returns content of the given resource.
      Specified by:
      getResourceContent in interface Page
      Parameters:
      frameId - Frame id to get resource for.
      url - URL of the resource to get content for.
      Returns:
      GetResourceContentResult
    • getResourceTree

      public FrameResourceTree getResourceTree()
      Description copied from interface: Page
      Returns present frame / resource tree structure.
      Specified by:
      getResourceTree in interface Page
      Returns:
      Present frame / resource tree structure.
    • handleJavaScriptDialog

      public void handleJavaScriptDialog​(java.lang.Boolean accept, java.lang.String promptText)
      Description copied from interface: Page
      Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
      Specified by:
      handleJavaScriptDialog in interface Page
      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

      public NavigateResult navigate​(java.lang.String url, java.lang.String referrer, TransitionType transitionType, java.lang.String frameId)
      Description copied from interface: Page
      Navigates current page to the given URL.
      Specified by:
      navigate in interface Page
      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

      public void navigateToHistoryEntry​(java.lang.Integer entryId)
      Description copied from interface: Page
      Navigates current page to the given history entry.
      Specified by:
      navigateToHistoryEntry in interface Page
      Parameters:
      entryId - Unique id of the entry to navigate to.
    • printToPDF

      public 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)
      Description copied from interface: Page
      Print page as PDF.
      Specified by:
      printToPDF in interface Page
      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

      public void reload​(java.lang.Boolean ignoreCache, java.lang.String scriptToEvaluateOnLoad)
      Description copied from interface: Page
      Reloads given page optionally ignoring the cache.
      Specified by:
      reload in interface Page
      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

      public void removeScriptToEvaluateOnLoad​(java.lang.String identifier)
      Description copied from interface: Page
      Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
      Specified by:
      removeScriptToEvaluateOnLoad in interface Page
    • removeScriptToEvaluateOnNewDocument

      public void removeScriptToEvaluateOnNewDocument​(java.lang.String identifier)
      Description copied from interface: Page
      Removes given script from the list.
      Specified by:
      removeScriptToEvaluateOnNewDocument in interface Page
    • screencastFrameAck

      public void screencastFrameAck​(java.lang.Integer sessionId)
      Description copied from interface: Page
      Acknowledges that a screencast frame has been received by the frontend.
      Specified by:
      screencastFrameAck in interface Page
      Parameters:
      sessionId - Frame number.
    • searchInResource

      public 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)
      Description copied from interface: Page
      Searches for given string in resource content.
      Specified by:
      searchInResource in interface Page
      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

      public void setAdBlockingEnabled​(java.lang.Boolean enabled)
      Description copied from interface: Page
      Enable Chrome's experimental ad filter on all sites.
      Specified by:
      setAdBlockingEnabled in interface Page
      Parameters:
      enabled - Whether to block ads.
    • setBypassCSP

      public void setBypassCSP​(java.lang.Boolean enabled)
      Description copied from interface: Page
      Enable page Content Security Policy by-passing.
      Specified by:
      setBypassCSP in interface Page
      Parameters:
      enabled - Whether to bypass page CSP.
    • setDeviceMetricsOverride

      public 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)
      Description copied from interface: Page
      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).
      Specified by:
      setDeviceMetricsOverride in interface Page
      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

      public void setDeviceOrientationOverride​(java.lang.Double alpha, java.lang.Double beta, java.lang.Double gamma)
      Description copied from interface: Page
      Overrides the Device Orientation.
      Specified by:
      setDeviceOrientationOverride in interface Page
      Parameters:
      alpha - Mock alpha
      beta - Mock beta
      gamma - Mock gamma
    • setFontFamilies

      public void setFontFamilies​(FontFamilies fontFamilies)
      Description copied from interface: Page
      Set generic font families.
      Specified by:
      setFontFamilies in interface Page
      Parameters:
      fontFamilies - Specifies font families to set. If a font family is not specified, it won't be changed.
    • setFontSizes

      public void setFontSizes​(FontSizes fontSizes)
      Description copied from interface: Page
      Set default font sizes.
      Specified by:
      setFontSizes in interface Page
      Parameters:
      fontSizes - Specifies font sizes to set. If a font size is not specified, it won't be changed.
    • setDocumentContent

      public void setDocumentContent​(java.lang.String frameId, java.lang.String html)
      Description copied from interface: Page
      Sets given markup as the document's HTML.
      Specified by:
      setDocumentContent in interface Page
      Parameters:
      frameId - Frame id to set HTML for.
      html - HTML content to set.
    • setDownloadBehavior

      public void setDownloadBehavior​(DownloadBehavior behavior, java.lang.String downloadPath)
      Description copied from interface: Page
      Set the behavior when downloading a file.
      Specified by:
      setDownloadBehavior in interface Page
      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

      public void setGeolocationOverride​(java.lang.Double latitude, java.lang.Double longitude, java.lang.Double accuracy)
      Description copied from interface: Page
      Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
      Specified by:
      setGeolocationOverride in interface Page
      Parameters:
      latitude - Mock latitude
      longitude - Mock longitude
      accuracy - Mock accuracy
    • setLifecycleEventsEnabled

      public void setLifecycleEventsEnabled​(java.lang.Boolean enabled)
      Description copied from interface: Page
      Controls whether page will emit lifecycle events.
      Specified by:
      setLifecycleEventsEnabled in interface Page
      Parameters:
      enabled - If true, starts emitting lifecycle events.
    • setTouchEmulationEnabled

      public void setTouchEmulationEnabled​(java.lang.Boolean enabled, Platform configuration)
      Description copied from interface: Page
      Toggles mouse event-based touch event emulation.
      Specified by:
      setTouchEmulationEnabled in interface Page
      Parameters:
      enabled - Whether the touch event emulation should be enabled.
      configuration - Touch/gesture events configuration. Default: current platform.
    • startScreencast

      public void startScreencast​(ImageFormat format, java.lang.Integer quality, java.lang.Integer maxWidth, java.lang.Integer maxHeight, java.lang.Integer everyNthFrame)
      Description copied from interface: Page
      Starts sending each frame using the `screencastFrame` event.
      Specified by:
      startScreencast in interface Page
      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

      public void stopLoading()
      Description copied from interface: Page
      Force the page stop all navigations and pending resource fetches.
      Specified by:
      stopLoading in interface Page
    • crash

      public void crash()
      Description copied from interface: Page
      Crashes renderer on the IO thread, generates minidumps.
      Specified by:
      crash in interface Page
    • close

      public void close()
      Description copied from interface: Page
      Tries to close page, running its beforeunload hooks, if any.
      Specified by:
      close in interface Page
    • setWebLifecycleState

      public void setWebLifecycleState​(TargetLifecycleState state)
      Description copied from interface: Page
      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/
      Specified by:
      setWebLifecycleState in interface Page
      Parameters:
      state - Target lifecycle state
    • stopScreencast

      public void stopScreencast()
      Description copied from interface: Page
      Stops sending each frame in the `screencastFrame`.
      Specified by:
      stopScreencast in interface Page
    • setProduceCompilationCache

      public void setProduceCompilationCache​(java.lang.Boolean enabled)
      Description copied from interface: Page
      Forces compilation cache to be generated for every subresource script.
      Specified by:
      setProduceCompilationCache in interface Page
    • addCompilationCache

      public void addCompilationCache​(java.lang.String url, java.lang.String data)
      Description copied from interface: Page
      Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation.
      Specified by:
      addCompilationCache in interface Page
      data - Base64-encoded data
    • clearCompilationCache

      public void clearCompilationCache()
      Description copied from interface: Page
      Clears seeded compilation cache.
      Specified by:
      clearCompilationCache in interface Page
    • generateTestReport

      public void generateTestReport​(java.lang.String message, java.lang.String group)
      Description copied from interface: Page
      Generates a report for testing.
      Specified by:
      generateTestReport in interface Page
      Parameters:
      message - Message to be displayed in the report.
      group - Specifies the endpoint group to deliver the report to.
    • waitForDebugger

      public void waitForDebugger()
      Description copied from interface: Page
      Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.
      Specified by:
      waitForDebugger in interface Page
    • setInterceptFileChooserDialog

      public void setInterceptFileChooserDialog​(java.lang.Boolean enabled)
      Description copied from interface: Page
      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.
      Specified by:
      setInterceptFileChooserDialog in interface Page
    • addScriptToEvaluateOnNewDocument

      public java.lang.String addScriptToEvaluateOnNewDocument​(java.lang.String source)
      Description copied from interface: Page
      Evaluates given script in every frame upon creation (before loading frame's scripts).
      Specified by:
      addScriptToEvaluateOnNewDocument in interface Page
      Returns:
      Identifier of the added script.
    • captureScreenshot

      public byte[] captureScreenshot()
      Description copied from interface: Page
      Capture page screenshot.
      Specified by:
      captureScreenshot in interface Page
      Returns:
      Base64-encoded image data.
    • captureSnapshot

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

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

      public void handleJavaScriptDialog​(java.lang.Boolean accept)
      Description copied from interface: Page
      Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
      Specified by:
      handleJavaScriptDialog in interface Page
      Parameters:
      accept - Whether to accept or dismiss the dialog.
    • navigate

      public NavigateResult navigate​(java.lang.String url)
      Description copied from interface: Page
      Navigates current page to the given URL.
      Specified by:
      navigate in interface Page
      Parameters:
      url - URL to navigate the page to.
      Returns:
      NavigateResult
    • printToPDF

      public PrintToPDFResult printToPDF()
      Description copied from interface: Page
      Print page as PDF.
      Specified by:
      printToPDF in interface Page
      Returns:
      PrintToPDFResult
    • reload

      public void reload()
      Description copied from interface: Page
      Reloads given page optionally ignoring the cache.
      Specified by:
      reload in interface Page
    • searchInResource

      public java.util.List<SearchMatch> searchInResource​(java.lang.String frameId, java.lang.String url, java.lang.String query)
      Description copied from interface: Page
      Searches for given string in resource content.
      Specified by:
      searchInResource in interface Page
      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

      public void setDeviceMetricsOverride​(java.lang.Integer width, java.lang.Integer height, java.lang.Double deviceScaleFactor, java.lang.Boolean mobile)
      Description copied from interface: Page
      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).
      Specified by:
      setDeviceMetricsOverride in interface Page
      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

      public void setDownloadBehavior​(DownloadBehavior behavior)
      Description copied from interface: Page
      Set the behavior when downloading a file.
      Specified by:
      setDownloadBehavior in interface Page
      Parameters:
      behavior - Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
    • setGeolocationOverride

      public void setGeolocationOverride()
      Description copied from interface: Page
      Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
      Specified by:
      setGeolocationOverride in interface Page
    • setTouchEmulationEnabled

      public void setTouchEmulationEnabled​(java.lang.Boolean enabled)
      Description copied from interface: Page
      Toggles mouse event-based touch event emulation.
      Specified by:
      setTouchEmulationEnabled in interface Page
      Parameters:
      enabled - Whether the touch event emulation should be enabled.
    • startScreencast

      public void startScreencast()
      Description copied from interface: Page
      Starts sending each frame using the `screencastFrame` event.
      Specified by:
      startScreencast in interface Page
    • generateTestReport

      public void generateTestReport​(java.lang.String message)
      Description copied from interface: Page
      Generates a report for testing.
      Specified by:
      generateTestReport in interface Page
      Parameters:
      message - Message to be displayed in the report.