From d807767fd15cc6133f4af5c89b5f0c932b63e6b6 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Wed, 7 Aug 2024 10:14:50 +0200 Subject: [PATCH] fix(browser): use documentElement as the root for selector --- packages/browser/src/client/tester/locators/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/browser/src/client/tester/locators/index.ts b/packages/browser/src/client/tester/locators/index.ts index e2bcf187bb04..229e33eeeac7 100644 --- a/packages/browser/src/client/tester/locators/index.ts +++ b/packages/browser/src/client/tester/locators/index.ts @@ -147,7 +147,7 @@ export abstract class Locator { return this._forceElement } const parsedSelector = this._parsedSelector || (this._parsedSelector = selectorEngine.parseSelector(this._pwSelector || this.selector)) - return selectorEngine.querySelector(parsedSelector, document.body, true) + return selectorEngine.querySelector(parsedSelector, document.documentElement, true) } public element(): Element { @@ -163,7 +163,7 @@ export abstract class Locator { return [this._forceElement] } const parsedSelector = this._parsedSelector || (this._parsedSelector = selectorEngine.parseSelector(this._pwSelector || this.selector)) - return selectorEngine.querySelectorAll(parsedSelector, document.body) + return selectorEngine.querySelectorAll(parsedSelector, document.documentElement) } public all(): Locator[] {