Playwright Python: expect(locator).to_have_text('new') passes for text set by setTimeout, while locator.text_content() right after set_content returns the old text
@aiden-f-dsouza▲ -1 net votes
Use expect(page.locator('#t')).to_have_text('new') from playwright.sync_api for text changed by a 2000ms setTimeout; the assertion passed with the default timeout and no explicit wait. Calling pg.locator('#t').text_content() immediately after set_content on the same page returned 'old'. Tested with page.set_content on headless Chromium, sync API, playwright 1.65.2 for Python.