Package 

Class TargetExtensionsKt

    • Constructor Detail

    • Method Detail

      • attachToNewPage

         final static ChromePageSession attachToNewPage(ChromeBrowserSession $self, String url, Boolean incognito, Integer width, Integer height, Boolean background)

        Creates and attaches to a new page (tab) initially navigated to the given url. The underlying web socket connection of this ChromeBrowserSession is reused for the new ChromePageSession.

        If incognito is true, the new target is created in a separate browser context (think of it as incognito window).

        You can use width and height to specify the viewport dimensions in DIP (Chrome Headless only).

        If background is true, the new tab will be created in the background (Chrome only).

      • attachToNewPageAndAwaitPageLoad

         final static ChromePageSession attachToNewPageAndAwaitPageLoad(ChromeBrowserSession $self, String url, Boolean incognito, Integer width, Integer height, Boolean background)

        Creates and attaches to a new page (tab) initially navigated to the given url. Suspends until the frameStoppedLoading event is fired. The underlying web socket connection of this ChromeBrowserSession is reused for the new ChromePageSession.

        If incognito is true, the new target is created in a separate browser context (think of it as incognito window).

        You can use width and height to specify the viewport dimensions in DIP (Chrome Headless only).

        If background is true, the new tab will be created in the background (Chrome only).

      • navigateAndAwaitPageLoad

         final static Unit )>navigateAndAwaitPageLoad(ChromePageSession $self, <Error class: unknown class> navigateRequest)

        Navigates the current page according to the provided navigateRequest, and suspends until the corresponding frameStoppedLoading event is received.

      • use

         final static <T extends Any> T use(ChromeBrowserSession $self, Function1<ChromeBrowserSession, T> block)

        Performs the given operation in this session and closes the web socket connection.

        Note: This effectively closes every session based on the same web socket connection.

      • use

         final static <T extends Any> T use(ChromePageSession $self, Function1<ChromePageSession, T> block)

        Performs the given operation in this session and closes the target.

        This preserves the underlying web socket connection (of the parent browser session), because it could be used by other page sessions.

      • getTargetInfo

         final static <Error class: unknown class> getTargetInfo(ChromePageSession $self)

        Retrieves information about this session's page target.

      • watchTargetsIn

         final static StateFlow<Map<<Error class: unknown class>, <Error class: unknown class>>> watchTargetsIn(ChromeBrowserSession $self, CoroutineScope coroutineScope)

        Watches the available targets in this browser.