Audit of all playwright-go v0.5200.0 API calls, fixing deprecated usage, resource leaks, and teardown ordering:
Replace deprecated Locator.Type() with PressSequentially() in node.go — Type() was deprecated in Playwright v1.45; PressSequentially() preserves the same key-by-key behavior
Fix page leak on Goto failure in playwright.go — NewPage() created a page that was never closed if Goto returned an error
Fix teardown order in playWrightBrowser.Close() — context should close before browser (matching interactiveBrowser.Close() which already had the correct order)
Fix resource leak on NewPage failure in interactive.go — if initBrowser succeeded but NewPage failed, the Playwright process, browser, and context were leaked
Fix resource leak on context cancellation in both NewBrowser and NewInteractiveBrowser — if the Go context was cancelled mid-setup, the goroutine's browser resources were abandoned
## Summary
Audit of all `playwright-go` v0.5200.0 API calls, fixing deprecated usage, resource leaks, and teardown ordering:
- **Replace deprecated `Locator.Type()`** with `PressSequentially()` in `node.go` — `Type()` was deprecated in Playwright v1.45; `PressSequentially()` preserves the same key-by-key behavior
- **Fix page leak on `Goto` failure** in `playwright.go` — `NewPage()` created a page that was never closed if `Goto` returned an error
- **Fix teardown order** in `playWrightBrowser.Close()` — context should close before browser (matching `interactiveBrowser.Close()` which already had the correct order)
- **Fix resource leak on `NewPage` failure** in `interactive.go` — if `initBrowser` succeeded but `NewPage` failed, the Playwright process, browser, and context were leaked
- **Fix resource leak on context cancellation** in both `NewBrowser` and `NewInteractiveBrowser` — if the Go context was cancelled mid-setup, the goroutine's browser resources were abandoned
## Test plan
- [x] `go build ./...` passes
- [x] `go vet ./...` passes
- [x] `golangci-lint run` introduces zero new issues
- [x] `go test ./...` all existing tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Replace deprecated Locator.Type() with PressSequentially() (node.go)
- Close page on Goto failure to prevent resource leak (playwright.go)
- Fix teardown order: close context before browser (playwright.go)
- Clean up resources on NewPage failure (interactive.go)
- Spawn cleanup goroutine on context cancellation in both constructors
Co-Authored-By: Claude Opus 4.6 <[email protected]>
steve
merged commit 61b68adfd0 into main2026-03-02 04:59:43 +00:00
steve
deleted branch fix/playwright-api-audit2026-03-02 04:59:43 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Audit of all
playwright-gov0.5200.0 API calls, fixing deprecated usage, resource leaks, and teardown ordering:Locator.Type()withPressSequentially()innode.go—Type()was deprecated in Playwright v1.45;PressSequentially()preserves the same key-by-key behaviorGotofailure inplaywright.go—NewPage()created a page that was never closed ifGotoreturned an errorplayWrightBrowser.Close()— context should close before browser (matchinginteractiveBrowser.Close()which already had the correct order)NewPagefailure ininteractive.go— ifinitBrowsersucceeded butNewPagefailed, the Playwright process, browser, and context were leakedNewBrowserandNewInteractiveBrowser— if the Go context was cancelled mid-setup, the goroutine's browser resources were abandonedTest plan
go build ./...passesgo vet ./...passesgolangci-lint runintroduces zero new issuesgo test ./...all existing tests pass🤖 Generated with Claude Code