-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[fix]: ctx addInitScript on popup pages
#1642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@browserbasehq/stagehand": patch | ||
| --- | ||
|
|
||
| fix issue where scripts added via context.addInitScripts() were not being injected into new pages that were opened via popups (eg, clicking a link that opens a new page) and/or calling context.newPage(url) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,12 +109,7 @@ export class CdpConnection implements CDPSessionLike { | |
| await this.send("Target.setAutoAttach", { | ||
| autoAttach: true, | ||
| flatten: true, | ||
| waitForDebuggerOnStart: false, | ||
| filter: [ | ||
| { type: "worker", exclude: true }, | ||
| { type: "shared_worker", exclude: true }, | ||
| { type: "service_worker", exclude: true }, | ||
| ], | ||
| waitForDebuggerOnStart: true, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this might have a stealth/reliability impact, gaps in runtime performance metrics as a result of debuggerOnStart are one of the signals bot-blockers use iirc. Also there are weird situations with using might be worth only setting this if there are initScripts needed Further reading on issues with
|
||
| }); | ||
| await this.send("Target.setDiscoverTargets", { discover: true }); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:
addInitScripts()should beaddInitScript()(no 's' at the end)Prompt To Fix With AI