Class Session

    • Method Detail

      • getId

        public java.lang.String getId()
      • close

        public void close()
        Close the this browser window
        Specified by:
        close in interface java.lang.AutoCloseable
      • isConnected

        public boolean isConnected()
      • activate

        public void activate()
        Activate this browser window
      • addEventListener

        public void addEventListener​(EventListener eventListener)
        Use Session#getListenerManager()
      • removeEventEventListener

        public void removeEventEventListener​(EventListener eventListener)
        Use Session#getListenerManager()
      • waitDocumentReady

        public Session waitDocumentReady()
        waits until document is ready
        Returns:
        this
      • waitDocumentReady

        public Session waitDocumentReady​(int timeout)
        waits until document is ready
        Parameters:
        timeout - the maximum time to wait in milliseconds
        Returns:
        this
      • waitUntil

        public boolean waitUntil​(java.util.function.Predicate<Session> predicate)
      • waitUntil

        public boolean waitUntil​(java.util.function.Predicate<Session> predicate,
                                 int timeout)
      • waitUntil

        public boolean waitUntil​(java.util.function.Predicate<Session> predicate,
                                 int timeout,
                                 int period)
      • waitUntil

        public boolean waitUntil​(java.util.function.Predicate<Session> predicate,
                                 int timeout,
                                 int period,
                                 boolean log)
      • navigate

        public Session navigate​(java.lang.String url)
      • navigateAndWait

        public Session navigateAndWait​(java.lang.String url,
                                       WaitUntil condition)
      • navigateAndWait

        public Session navigateAndWait​(java.lang.String url,
                                       WaitUntil condition,
                                       int timeout)
      • enableConsoleLog

        public Session enableConsoleLog()
        Redirects javascript console logs to slf4j
        Returns:
        this
      • enableDetailLog

        public Session enableDetailLog()
        Redirects runtime logs (network, security, storage etc..) to slf4j
        Returns:
        this
      • enableNetworkLog

        public Session enableNetworkLog()
        Redirects network logs to slf4j
        Returns:
        this
      • getFrameId

        public java.lang.String getFrameId()
      • captureScreenshot

        public byte[] captureScreenshot()
        Capture page screenshot.
      • captureScreenshot

        public byte[] captureScreenshot​(boolean hideScrollbar)
        Capture page screenshot.
        Parameters:
        hideScrollbar - hides the scollbar
      • captureScreenshot

        public byte[] captureScreenshot​(boolean hideScrollbar,
                                        ImageFormat format,
                                        java.lang.Integer quality,
                                        Viewport clip,
                                        java.lang.Boolean fromSurface)
        Capture page screenshot.
        Parameters:
        hideScrollbar - hides the scollbar
        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.
      • wait

        public Session wait​(int timeout)
        Causes the current thread to wait until waiting time elapses.
        Parameters:
        timeout - the maximum time to wait in milliseconds
        Returns:
        this
        Throws:
        CdpException - if the session held by another thread at the time of invocation.
      • wait

        public Session wait​(int timeout,
                            boolean log)
        Causes the current thread to wait until waiting time elapses.
        Parameters:
        timeout - the maximum time to wait in milliseconds
        Returns:
        this
        Throws:
        CdpException - if the session held by another thread at the time of invocation.
      • getCommand

        public Command getCommand()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • registerJsFunction

        public <T> T registerJsFunction​(java.lang.Class<T> klass)
      • getJsFunction

        public <T> T getJsFunction​(java.lang.Class<T> klass)
      • getMajorVersion

        public int getMajorVersion()
      • getTargetId

        public java.lang.String getTargetId()
      • getBrowserContextId

        public java.lang.String getBrowserContextId()
      • getExecutionContextId

        public java.lang.Integer getExecutionContextId()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object