Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 939dc7c

Browse files
committed
Enhance waitForSelector error messages
Closes #181
1 parent 54cd293 commit 939dc7c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

common/frame.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ func (f *Frame) waitForSelector(selector string, opts *FrameWaitForSelectorOptio
560560
return nil, err
561561
}
562562
if handle == nil {
563-
return nil, errors.New("wait for selector didn't resulted in any nodes")
563+
return nil, fmt.Errorf("wait for selector %q did not result in any nodes", selector)
564564
}
565565

566566
// We always return ElementHandles in the main execution context (aka "DOM world")
@@ -569,14 +569,14 @@ func (f *Frame) waitForSelector(selector string, opts *FrameWaitForSelectorOptio
569569

570570
ec := f.executionContexts[mainWorld]
571571
if ec == nil {
572-
return nil, fmt.Errorf("wait for selector cannot find execution context: %q", mainWorld)
572+
return nil, fmt.Errorf("wait for selector %q cannot find execution context: %q", selector, mainWorld)
573573
}
574574
// an element should belong to the current execution context.
575575
// otherwise, we should adopt it to this execution context.
576576
if ec != handle.execCtx {
577577
defer handle.Dispose()
578578
if handle, err = ec.adoptElementHandle(handle); err != nil {
579-
return nil, fmt.Errorf("wait for selector cannot adopt element handle: %w", err)
579+
return nil, fmt.Errorf("wait for selector %q cannot adopt element handle: %w", selector, err)
580580
}
581581
}
582582

0 commit comments

Comments
 (0)