Skip to content

Commit f47f92d

Browse files
committed
Fix hit target check to prevent null error
This is also how Playwright handles the same null errors.
1 parent 8992f57 commit f47f92d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/js/modules/k6/browser/common/js/injected_script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,7 @@ class InjectedScript {
19381938
if (hitElement === element) {
19391939
return "done";
19401940
}
1941-
const hitTargetDescription = this.previewNode(hitParents[0]);
1941+
const hitTargetDescription = this.previewNode(hitParents[0] || document.documentElement);
19421942
// Root is the topmost element in the hitTarget's chain that is not in the
19431943
// element's chain. For example, it might be a dialog element that overlays
19441944
// the target.

0 commit comments

Comments
 (0)