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.
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user