-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Brief summary
Here's the stack trace:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x13957a1]
goroutine 1517439 [running]:
go.k6.io/k6/js/modules/k6/browser/common.(*Frame).waitForSelector.func1()
go.k6.io/k6/js/modules/k6/browser/common/frame.go:505 +0x21
go.k6.io/k6/js/modules/k6/browser/common.(*Frame).waitForSelector(0xc004638fc0, {0xc00041e2d0, 0x2a}, 0xc00005d3e0)
go.k6.io/k6/js/modules/k6/browser/common/frame.go:511 +0x434
go.k6.io/k6/js/modules/k6/browser/common.(*Frame).typ.(*Frame).newAction.func2({0x1f9f158, 0xc001bee770}, 0xc004f21340, 0xc004f21c70)
go.k6.io/k6/js/modules/k6/browser/common/frame.go:2111 +0xfb
created by go.k6.io/k6/js/modules/k6/browser/common.call in goroutine 1517438
go.k6.io/k6/js/modules/k6/browser/common/helpers.go:104 +0x14c
Looking at the code in question:
defer func() {
if err := handle.Dispose(); err != nil {
err = fmt.Errorf("disposing element handle: %w", err)
rerr = errors.Join(err, rerr)
}
}()
if handle, err = ec.adoptElementHandle(handle); err != nil {
return nil, fmt.Errorf("waiting for selector %q: adopting element handle: %w", selector, err)
}
If an error is returned from ec.adoptElementHandle
it overwrites the handle
with a nil
. The deferred function tries to use the handle
but fails with an NPD since it is now nil
.
k6 version
v0.56.0
OS
na
Docker version and image (if applicable)
No response
Steps to reproduce the problem
NA
Expected behaviour
Don't NPD
Actual behaviour
NPD