Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Force BrowserContext to use Browser.UserAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Nov 12, 2024
1 parent ecc2011 commit e37be47
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions common/browser_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ func NewBrowserContext(
if opts == nil {
opts = DefaultBrowserContextOptions()
}
// Always use the [Browser]'s user agent if it's not set by the user.
// Setting this forces [FrameSession] to set Chromium's user agent.
if strings.TrimSpace(opts.UserAgent) == "" {
opts.UserAgent = browser.UserAgent()
}

b := BrowserContext{
BaseEventEmitter: NewBaseEventEmitter(ctx),
Expand Down

0 comments on commit e37be47

Please sign in to comment.