playwright-community / playwright-go

Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.
https://playwright-community.github.io/playwright-go/
MIT License
1.94k stars 144 forks source link

[Bug]: Setting the useragent in the context will cause the password input of Twitter's Your Account to be invalid when viewing account information #470

Open twolao opened 1 week ago

twolao commented 1 week ago

Environments

Bug description after set user-agent, browserscan.net check is ok, only twitter's Your Account to be invalid when viewing account information need to submit password, console hasn't error info, result is cann't go into infopage to.view account information



**Additional context**
Add any other context about the problem here.
canstand commented 1 week ago

It seems to be Twitter's security verification mechanism, not related to playwright.

twolao commented 1 week ago

It seems to be Twitter's security verification mechanism, not related to playwright.

The following code modifies the useragent and it works fine when submitting the password confirmation on Twitter. However, when using the playwright.BrowserTypeLaunchPersistentContextOptions setting, the above exception will be encountered. Maybe there is a bug in code.

browserContext.Route("**/*", func(route playwright.Route) {
            request := route.Request()
            headers := request.Headers()
            headers["user-agent"] = "my userAgent1.0"
            log.Println("\n\n# ",headers)
            route.Continue(playwright.RouteContinueOptions{
                Headers: headers,
            })
        })