diff --git a/lib/FrameManager.js b/lib/FrameManager.js index 2e25f8c4634..847310c3751 100644 --- a/lib/FrameManager.js +++ b/lib/FrameManager.js @@ -497,7 +497,8 @@ async function waitForPredicatePageFunction(predicateBody, polling, timeout) { }); observer.observe(document, { childList: true, - subtree: true + subtree: true, + attributes: true }); return result; } diff --git a/test/test.js b/test/test.js index 261c632e5c7..6bbfc9ed455 100644 --- a/test/test.js +++ b/test/test.js @@ -451,6 +451,15 @@ describe('Page', function() { expect(error).toBeTruthy(); expect(error.message).toContain('waiting failed: timeout'); })); + + it('should respond to node attribute mutation', SX(async function() { + let divFound = false; + const waitForSelector = page.waitForSelector('.zombo').then(() => divFound = true); + await page.setContent(`
`); + expect(divFound).toBe(false); + await page.evaluate(() => document.querySelector('div').className = 'zombo'); + expect(await waitForSelector).toBe(true); + })); }); describe('Page.waitFor', function() {