From 8e4a1e7c67f71ae595e3ceee1adb1a0a4ce8efd8 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 29 May 2020 15:28:27 -0700 Subject: [PATCH] fix(text selector): do not match text inside (#2413) We already skip + + + + + +
title script style
+ `); + const head = await page.$('head'); + const title = await page.$('title'); + const script = await page.$('body script'); + const style = await page.$('body style'); + for (const text of ['title', 'script', 'style']) { + expect(await page.$eval(`text=${text}`, e => e.nodeName)).toBe('DIV'); + expect(await page.$$eval(`text=${text}`, els => els.map(e => e.nodeName).join('|'))).toBe('DIV'); + for (const root of [head, title, script, style]) { + expect(await root.$(`text=${text}`)).toBe(null); + expect(await root.$$eval(`text=${text}`, els => els.length)).toBe(0); + } + } + }); + it('should match input[type=button|submit]', async({page}) => { await page.setContent(``); expect(await page.$eval(`text=hello`, e => e.outerHTML)).toBe('');