From 65b0470c5ab699b8232676f4b5f1ee6fea86d9a3 Mon Sep 17 00:00:00 2001 From: ankur22 Date: Fri, 20 Sep 2024 17:19:55 +0100 Subject: [PATCH] Fix NPD in getOwnerFrame The node from dom.DescribeNode() can be nil, so checking for nil before proceeding. --- common/page.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/page.go b/common/page.go index 1c2b96394..53044b399 100644 --- a/common/page.go +++ b/common/page.go @@ -486,6 +486,11 @@ func (p *Page) getOwnerFrame(apiCtx context.Context, h *ElementHandle) (cdp.Fram return "", nil } + if node == nil { + p.logger.Debugf("Page:getOwnerFrame:node:nil:return", "sid:%v err:%v", p.sessionID(), err) + return "", nil + } + frameID := node.FrameID if err := documentElement.Dispose(); err != nil { return "", fmt.Errorf("disposing document element while getting owner frame: %w", err)