Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: fix xpath-in-iframe (#21367)
Pavel Feldmanc17eea7a3c81
diff --git a/packages/playwright-core/src/server/injected/xpathSelectorEngine.ts b/packages/playwright-core/src/server/injected/xpathSelectorEngine.tsindex f12dd4d3f4..7964ef4d46 100644--- a/packages/playwright-core/src/server/injected/xpathSelectorEngine.ts+++ b/packages/playwright-core/src/server/injected/xpathSelectorEngine.ts@@ -21,7 +21,7 @@ export const XPathEngine: SelectorEngine = {if (selector.startsWith('/'))selector = '.' + selector;const result: Element[] = [];- const document = root instanceof Document ? root : root.ownerDocument;+ const document = root.ownerDocument || root;if (!document)return result;const it = document.evaluate(selector, root, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE);