diff --git a/common/js_handle.go b/common/js_handle.go index f551c0feb..86cd291b0 100644 --- a/common/js_handle.go +++ b/common/js_handle.go @@ -2,6 +2,7 @@ package common import ( "context" + "errors" "fmt" "github.com/grafana/xk6-browser/k6ext" @@ -81,6 +82,10 @@ func (h *BaseJSHandle) AsElement() *ElementHandle { func (h *BaseJSHandle) Dispose() { fmt.Println(">>>>>>: BaseJSHandler Dispose") if err := h.dispose(); err != nil { + if errors.Is(err, context.Canceled) { + fmt.Println(">>>>>>: Skipping context canceled error on Dispose", err) + return + } fmt.Println(">>>>>>: BaseJSHandler Dispose error", err) k6ext.Panic(h.ctx, "dispose: %w", err) }