Skip to content

Commit ae635cd

Browse files
committed
rm getShadowRootHandle
1 parent b6a4719 commit ae635cd

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

lib/StagehandPage.ts

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
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";
72
import { selectors } from "playwright";
83
import { z } from "zod/v3";
94
import { Page, defaultExtractSchema } from "../types/page";
@@ -35,7 +30,6 @@ import {
3530
import { StagehandAPIError } from "@/types/stagehandApiErrors";
3631
import { scriptContent } from "@/lib/dom/build/scriptContent";
3732
import type { Protocol } from "devtools-protocol";
38-
import { StagehandBackdoor } from "@/lib/dom/global";
3933

4034
async function getCurrentRootFrameId(session: CDPSession): Promise<string> {
4135
const { frameTree } = (await session.send(
@@ -1121,23 +1115,4 @@ ${scriptContent} \
11211115
): Promise<void> {
11221116
await this.sendCDP<void>(`${domain}.disable`, {}, target);
11231117
}
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-
}
11431118
}

0 commit comments

Comments
 (0)