Skip to content

Commit 054103b

Browse files
committed
make sure __stagehand__ is not defined before we attempt to define it
1 parent 4f1fa48 commit 054103b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/dom/process.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,14 @@ export async function getScrollableElementXpaths(
125125
},
126126
};
127127

128-
Object.defineProperty(window, "__stagehand__", {
129-
value: backdoor,
130-
enumerable: false,
131-
writable: false,
132-
configurable: false,
133-
});
128+
if (!("__stagehand__" in window)) {
129+
Object.defineProperty(window, "__stagehand__", {
130+
value: backdoor,
131+
enumerable: false,
132+
writable: false,
133+
configurable: false,
134+
});
135+
}
134136
})();
135137

136138
window.getScrollableElementXpaths = getScrollableElementXpaths;

0 commit comments

Comments
 (0)