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

feat: StorageState can convert to OptionalStorageState (close #414) #418

Closed canstand closed 4 months ago

canstand commented 4 months ago

This PR avoids manual conversion when there is no need to store StorageState as a file (solve #414)

storageState, _ = context1.StorageState()

context2, _ := browser.NewContext(
    playwright.BrowserNewContextOptions{
        StorageState: storageState.ToOptionalStorageState(),
    })