Interface Browser


  • public interface Browser
    The Browser domain defines methods and events for browser managing
    • Method Summary

      Modifier and Type Method Description
      void close()
      Close browser gracefully.
      void crash()
      Crashes browser on the main thread.
      java.util.List<java.lang.String> getBrowserCommandLine()
      Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline.
      Histogram getHistogram​(java.lang.String name)
      Get a Chrome histogram by name.
      Histogram getHistogram​(java.lang.String name, java.lang.Boolean delta)
      Get a Chrome histogram by name.
      java.util.List<Histogram> getHistograms()
      Get Chrome histograms.
      java.util.List<Histogram> getHistograms​(java.lang.String query, java.lang.Boolean delta)
      Get Chrome histograms.
      GetVersionResult getVersion()
      Returns version information.
      Bounds getWindowBounds​(java.lang.Integer windowId)
      Get position and size of the browser window.
      GetWindowForTargetResult getWindowForTarget()
      Get the browser window that contains the devtools target.
      GetWindowForTargetResult getWindowForTarget​(java.lang.String targetId)
      Get the browser window that contains the devtools target.
      void grantPermissions​(java.lang.String origin, PermissionType permissions)
      Grant specific permissions to the given origin and reject all others.
      void grantPermissions​(java.lang.String origin, PermissionType permissions, java.lang.String browserContextId)
      Grant specific permissions to the given origin and reject all others.
      void resetPermissions()
      Reset all permission management for all origins.
      void resetPermissions​(java.lang.String browserContextId)
      Reset all permission management for all origins.
      void setDockTile()
      Set dock tile details, platform-specific.
      void setDockTile​(java.lang.String badgeLabel, java.lang.String image)
      Set dock tile details, platform-specific.
      void setWindowBounds​(java.lang.Integer windowId, Bounds bounds)
      Set position and/or size of the browser window.
    • Method Detail

      • grantPermissions

        void grantPermissions​(java.lang.String origin,
                              PermissionType permissions,
                              java.lang.String browserContextId)
        Grant specific permissions to the given origin and reject all others.
        Parameters:
        browserContextId - BrowserContext to override permissions. When omitted, default browser context is used.
      • resetPermissions

        void resetPermissions​(java.lang.String browserContextId)
        Reset all permission management for all origins.
        Parameters:
        browserContextId - BrowserContext to reset permissions. When omitted, default browser context is used.
      • close

        void close()
        Close browser gracefully.
      • crash

        void crash()
        Crashes browser on the main thread.
      • getVersion

        GetVersionResult getVersion()
        Returns version information.
        Returns:
        GetVersionResult
      • getBrowserCommandLine

        java.util.List<java.lang.String> getBrowserCommandLine()
        Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline.
        Returns:
        Commandline parameters
      • getHistograms

        java.util.List<Histogram> getHistograms​(java.lang.String query,
                                                java.lang.Boolean delta)
        Get Chrome histograms.
        Parameters:
        query - Requested substring in name. Only histograms which have query as a substring in their name are extracted. An empty or absent query returns all histograms.
        delta - If true, retrieve delta since last call.
        Returns:
        Histograms.
      • getHistogram

        Histogram getHistogram​(java.lang.String name,
                               java.lang.Boolean delta)
        Get a Chrome histogram by name.
        Parameters:
        name - Requested histogram name.
        delta - If true, retrieve delta since last call.
        Returns:
        Histogram.
      • getWindowBounds

        Bounds getWindowBounds​(java.lang.Integer windowId)
        Get position and size of the browser window.
        Parameters:
        windowId - Browser window id.
        Returns:
        Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
      • getWindowForTarget

        GetWindowForTargetResult getWindowForTarget​(java.lang.String targetId)
        Get the browser window that contains the devtools target.
        Parameters:
        targetId - Devtools agent host id. If called as a part of the session, associated targetId is used.
        Returns:
        GetWindowForTargetResult
      • setWindowBounds

        void setWindowBounds​(java.lang.Integer windowId,
                             Bounds bounds)
        Set position and/or size of the browser window.
        Parameters:
        windowId - Browser window id.
        bounds - New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
      • setDockTile

        void setDockTile​(java.lang.String badgeLabel,
                         java.lang.String image)
        Set dock tile details, platform-specific.
        Parameters:
        image - Png encoded image.
      • grantPermissions

        void grantPermissions​(java.lang.String origin,
                              PermissionType permissions)
        Grant specific permissions to the given origin and reject all others.
      • resetPermissions

        void resetPermissions()
        Reset all permission management for all origins.
      • getHistograms

        java.util.List<Histogram> getHistograms()
        Get Chrome histograms.
        Returns:
        Histograms.
      • getHistogram

        Histogram getHistogram​(java.lang.String name)
        Get a Chrome histogram by name.
        Parameters:
        name - Requested histogram name.
        Returns:
        Histogram.
      • getWindowForTarget

        GetWindowForTargetResult getWindowForTarget()
        Get the browser window that contains the devtools target.
        Returns:
        GetWindowForTargetResult
      • setDockTile

        void setDockTile()
        Set dock tile details, platform-specific.