Skip to content

Instantly share code, notes, and snippets.

Created September 11, 2020 20:32
What would you like to do?
Playwright - accessing children nodes
it('should return one book when exact title is given', async () => {
await page.fill('#searchBar', 'Agile Testing')
await page.waitForSelector('li.ui-screen-hidden', { state: 'attached' })
const visibleBooksSelector = 'li:not(.ui-screen-hidden)'
const visibleBooks = await page.$$(visibleBooksSelector)
assert.equal(visibleBooks.length, 1)
assert.equal(await page.innerText(visibleBooksSelector + ' >> h2'), 'Agile Testing')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment