-
- All Implemented Interfaces:
public final class TargetExtensionsKt
-
-
Method Summary
Modifier and Type Method Description final static ChromePageSession)>attachToPage(ChromeBrowserSession $self, <Error class: unknown class> targetId)Creates a new ChromePageSession attached to the pageoriframetarget with the given targetId.final static ChromePageSessionattachToNewPage(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. final static ChromePageSessionattachToNewPageAndAwaitPageLoad(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. final static UnitnavigateAndAwaitPageLoad(ChromePageSession $self, String url)Navigates the current page to the provided url, and suspends until the corresponding frameStoppedLoadingevent is received.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 frameStoppedLoadingevent is received.final static List<<Error class: unknown class>>childPages(ChromePageSession $self)Finds page targets that were opened by this page. final static <T extends Any> Tuse(ChromeBrowserSession $self, Function1<ChromeBrowserSession, T> block)Performs the given operation in this session and closes the web socket connection. final static <T extends Any> Tuse(ChromePageSession $self, Function1<ChromePageSession, T> block)Performs the given operation in this session and closes the target. final static <Error class: unknown class>getTargetInfo(ChromePageSession $self)Retrieves information about this session's page target. final static StateFlow<Map<<Error class: unknown class>, <Error class: unknown class>>>watchTargetsIn(ChromeBrowserSession $self, CoroutineScope coroutineScope)Watches the available targets in this browser. -
-
Method Detail
-
attachToPage
final static ChromePageSession )>attachToPage(ChromeBrowserSession $self, <Error class: unknown class> targetId)
Creates a new ChromePageSession attached to the
pageoriframetarget with the given targetId. The new session shares the same underlying web socket connection as this ChromeBrowserSession.If the given ID corresponds to a target that is not a
pageoriframe, an exception is thrown.
-
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
frameStoppedLoadingevent 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, String url)
Navigates the current page to the provided url, and suspends until the corresponding
frameStoppedLoadingevent is received.
-
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
frameStoppedLoadingevent is received.
-
childPages
final static List<<Error class: unknown class>> childPages(ChromePageSession $self)
Finds page targets that were opened by this page.
-
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.
-
-
-
-