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
|
var launch = true
|
||||||
if opt.PlayWrightServerAddress != "" {
|
if opt.PlayWrightServerAddress != "" {
|
||||||
launch = false
|
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 err != nil {
|
||||||
if opt.DontLaunchOnConnectFailure {
|
if opt.DontLaunchOnConnectFailure {
|
||||||
|
Reference in New Issue
Block a user