Skip to content

Commit 73bac9c

Browse files
committed
Add ChromePageSession.childPages()
Resolves: #92
1 parent 326dd15 commit 73bac9c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

api/chrome-devtools-kotlin.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35900,6 +35900,7 @@ public final class org/hildan/chrome/devtools/targets/TargetExtensionsKt {
3590035900
public static final fun attachToNewPageAndAwaitPageLoad (Lorg/hildan/chrome/devtools/targets/ChromeBrowserSession;Ljava/lang/String;ZIIZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
3590135901
public static synthetic fun attachToNewPageAndAwaitPageLoad$default (Lorg/hildan/chrome/devtools/targets/ChromeBrowserSession;Ljava/lang/String;ZIIZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
3590235902
public static final fun attachToPage (Lorg/hildan/chrome/devtools/targets/ChromeBrowserSession;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
35903+
public static final fun childPages (Lorg/hildan/chrome/devtools/targets/ChromePageSession;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
3590335904
public static final fun getTargetInfo (Lorg/hildan/chrome/devtools/targets/ChromePageSession;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
3590435905
public static final fun navigateAndAwaitPageLoad (Lorg/hildan/chrome/devtools/targets/ChromePageSession;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
3590535906
public static final fun navigateAndAwaitPageLoad (Lorg/hildan/chrome/devtools/targets/ChromePageSession;Lorg/hildan/chrome/devtools/domains/page/NavigateRequest;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;

src/main/kotlin/org/hildan/chrome/devtools/targets/TargetExtensions.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ suspend fun ChromePageSession.navigateAndAwaitPageLoad(url: String) {
9393
}
9494

9595
/**
96-
* Navigates the current page to the provided [navigateRequest], and suspends until the corresponding
96+
* Navigates the current page according to the provided [navigateRequest], and suspends until the corresponding
9797
* `frameStoppedLoading` event is received.
9898
*/
9999
@OptIn(ExperimentalChromeApi::class)
@@ -109,6 +109,14 @@ suspend fun ChromePageSession.navigateAndAwaitPageLoad(navigateRequest: Navigate
109109
}
110110
}
111111

112+
/**
113+
* Finds page targets that were opened by this page.
114+
*/
115+
suspend fun ChromePageSession.childPages(): List<TargetInfo> {
116+
val thisTargetId = metaData.targetId
117+
return target.getTargets().targetInfos.filter { it.type == "page" && it.openerId == thisTargetId }
118+
}
119+
112120
/**
113121
* Performs the given operation in this session and closes the web socket connection.
114122
*

0 commit comments

Comments
 (0)