Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(zselector): do not use pseudo-element tag names as cues (#381)

Dmitry Gozman98a6f001bbba
diff --git a/src/injected/zsSelectorEngine.ts b/src/injected/zsSelectorEngine.ts
index 58f90ea8d6..f2d72dcf6e 100644
--- a/src/injected/zsSelectorEngine.ts
+++ b/src/injected/zsSelectorEngine.ts
@@ -563,7 +563,8 @@ class Engine {
appendCue(JSON.stringify(value), 'text', textScore, element, lca, value);
}
- appendCue(nodeName, 'tag', this.options.genericTagScore, element, lca, '');
+ if (!nodeName.startsWith('<pseudo') && !nodeName.startsWith('::'))
+ appendCue(nodeName, 'tag', this.options.genericTagScore, element, lca, '');
if (this.options.imgAltScore && nodeName === 'IMG') {
const alt = element.getAttribute('alt');
if (alt)