Skip to content

Commit d8076b5

Browse files
authored
Merge pull request #1389 from k1LoW/fix
2 parents 3b896a5 + 16eebc3 commit d8076b5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cdp.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ func (rnr *cdpRunner) Run(ctx context.Context, s *step) error {
129129
func (rnr *cdpRunner) run(ctx context.Context, cas CDPActions, s *step) error {
130130
o := s.parent
131131
if rnr.ctx == nil {
132-
allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), rnr.opts...)
132+
// Use WithoutCancel to prevent Chrome process from being killed by step-level cancellation,
133+
// as the browser instance is reused across multiple steps.
134+
allocCtx, cancel := chromedp.NewExecAllocator(context.WithoutCancel(ctx), rnr.opts...)
133135
ctxx, _ := chromedp.NewContext(allocCtx)
134136
rnr.ctx = ctxx
135137
rnr.cancel = cancel

0 commit comments

Comments
 (0)