We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I tried to change UserAgent while running headless mode to avoid HeadlessChrome, but it was not working; here is my config:
BrowserTypeLaunchOptions
Args: ["--disable-extensions","--disable-images","--window-size=1920,1080","--start-maximized", "--headless=new"] HandleSIGUP, HandleSIGINT, HandleSIGTERM: false IgnoreDefaultArgs: ["--enable-automation","--no-sandbox","--mute-audio","--headless","--disable-features"]
I ignored the default --headless flag because I want to use --headless=new to access chrome://version after trying --headless (failed).
--headless
BrowserNewContextOptions
UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
Actually, I tried to change userAgent in both headless and head mode but it's still not working. But right now, I'm dealing with headless mode.
Spec:
The text was updated successfully, but these errors were encountered:
Can't reproduce it. It worked fine in my test.
func TestHeadlessNew(t *testing.T) { b2, err := browserType.Launch(playwright.BrowserTypeLaunchOptions{ Headless: playwright.Bool(false), Args: []string{ "--disable-extensions", "--disable-images", "--window-size=1920,1080", "--start-maximized", "--headless=new", }, IgnoreDefaultArgs: []string{"--enable-automation", "--no-sandbox", "--mute-audio", "--headless", "--disable-features"}, }) require.NoError(t, err) defer b2.Close() nCtx, err := b2.NewContext(playwright.BrowserNewContextOptions{ UserAgent: playwright.String("foobar/1.0"), }) require.NoError(t, err) defer nCtx.Close() nPage, err := nCtx.NewPage() require.NoError(t, err) resChan := server.WaitForRequestChan("/empty.html") _, err = nPage.Goto(server.PREFIX + "/empty.html") require.NoError(t, err) res := <-resChan require.True(t, strings.HasPrefix(res.Header.Get("User-Agent"), "foobar")) }
Sorry, something went wrong.
No branches or pull requests
Hi, I tried to change UserAgent while running headless mode to avoid HeadlessChrome, but it was not working; here is my config:
BrowserTypeLaunchOptions
:I ignored the default
--headless
flag because I want to use --headless=new to access chrome://version after trying --headless (failed).BrowserNewContextOptions
Actually, I tried to change userAgent in both headless and head mode but it's still not working. But right now, I'm dealing with headless mode.
Spec:
The text was updated successfully, but these errors were encountered: