From f4caef22b0d5701e8745d8e8a12e29763f713c4d Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Fri, 10 Oct 2025 20:25:27 -0400 Subject: [PATCH] Add timeout option to Playwright server connection Introduced a 30-second timeout for connecting to the Playwright server. Added logging for connection attempts to improve debugging and enhance connection reliability. --- playwright.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/playwright.go b/playwright.go index e054be9..be19dce 100644 --- a/playwright.go +++ b/playwright.go @@ -167,7 +167,9 @@ func NewPlayWrightBrowser(opts ...PlayWrightBrowserOptions) (Browser, error) { var launch = true if opt.PlayWrightServerAddress != "" { launch = false - browser, err = bt.Connect(opt.PlayWrightServerAddress, playwright.BrowserTypeConnectOptions{}) + slog.Info("connecting to playwright server", "address", opt.PlayWrightServerAddress) + var timeout float64 = 30000 + browser, err = bt.Connect(opt.PlayWrightServerAddress, playwright.BrowserTypeConnectOptions{Timeout: &timeout}) if err != nil { if opt.DontLaunchOnConnectFailure {