-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Labels
Description
Context:
- Playwright Version: 0.16.0
- Operating System: Mac
- Node version: v13.11.0
- Browser: All
Code Snippet
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch()
const context = await browser.newContext()
const page = await context.newPage()
await page.setContent(`
<div class="wrapper">
<div>
<span>Should</span>
</div>
<div>
<span>match</span>
</div>
</div>`)
const elementByClass = await page.$('.wrapper')
const innerText = await elementByClass.innerText()
console.log('Inner Text matches regex:', /Should.*match/is.test(innerText))
const elementByText = await page.$('text=/Should.*match/is')
console.log('element not found:', elementByText === null)
await browser.close()
})()Output
Inner Text matches regex: true
element not found: true
Describe the bug
Since regex matches innerText of .wrapper element I expect it to be matched by selector.
maraisr