|
1 |
| -import type { |
2 |
| - CDPSession, |
3 |
| - Page as PlaywrightPage, |
4 |
| - Frame, |
5 |
| - ElementHandle, |
6 |
| -} from "playwright"; |
| 1 | +import type { CDPSession, Page as PlaywrightPage, Frame } from "playwright"; |
7 | 2 | import { selectors } from "playwright";
|
8 | 3 | import { z } from "zod/v3";
|
9 | 4 | import { Page, defaultExtractSchema } from "../types/page";
|
@@ -35,7 +30,6 @@ import {
|
35 | 30 | import { StagehandAPIError } from "@/types/stagehandApiErrors";
|
36 | 31 | import { scriptContent } from "@/lib/dom/build/scriptContent";
|
37 | 32 | import type { Protocol } from "devtools-protocol";
|
38 |
| -import { StagehandBackdoor } from "@/lib/dom/global"; |
39 | 33 |
|
40 | 34 | async function getCurrentRootFrameId(session: CDPSession): Promise<string> {
|
41 | 35 | const { frameTree } = (await session.send(
|
@@ -1121,23 +1115,4 @@ ${scriptContent} \
|
1121 | 1115 | ): Promise<void> {
|
1122 | 1116 | await this.sendCDP<void>(`${domain}.disable`, {}, target);
|
1123 | 1117 | }
|
1124 |
| - |
1125 |
| - async getShadowRootHandle( |
1126 |
| - this: StagehandPage, |
1127 |
| - host: ElementHandle<Element>, |
1128 |
| - ): Promise<ElementHandle<ShadowRoot> | null> { |
1129 |
| - const h = await host.evaluateHandle((el: Element): ShadowRoot | null => { |
1130 |
| - // Open root? |
1131 |
| - if ((el as HTMLElement).shadowRoot) |
1132 |
| - return (el as HTMLElement).shadowRoot!; |
1133 |
| - // Closed root kept in our isolated world |
1134 |
| - return ( |
1135 |
| - ( |
1136 |
| - window as Window & { __stagehand__?: StagehandBackdoor } |
1137 |
| - ).__stagehand__?.getClosedRoot(el) ?? null |
1138 |
| - ); |
1139 |
| - }); |
1140 |
| - |
1141 |
| - return h.asElement() as ElementHandle<ShadowRoot> | null; |
1142 |
| - } |
1143 | 1118 | }
|
0 commit comments