chrome-devtools-kotlin / org.hildan.chrome.devtools.targets / attachToNewPageAndAwaitPageLoad

attachToNewPageAndAwaitPageLoad

suspend fun ChromeBrowserSession.attachToNewPageAndAwaitPageLoad(url: String = "about:blank", incognito: Boolean = true, width: Int = 1024, height: Int = 768, background: Boolean = false): ChromePageSession

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).