From 04c970b186554541a052112699bf4795195cedac Mon Sep 17 00:00:00 2001 From: davert Date: Sun, 27 Oct 2024 02:09:05 +0300 Subject: [PATCH] fixed #4523 --- lib/helper/Playwright.js | 5 ++++- test/helper/webapi.js | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index 0921fb1ad..9db892f58 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -2843,7 +2843,10 @@ class Playwright extends Helper { const _contextObject = this.frame ? this.frame : contextObject let count = 0 do { - waiter = await _contextObject.locator(`:has-text("${text}")`).first().isVisible() + waiter = await _contextObject + .locator(`:has-text(${JSON.stringify(text)})`) + .first() + .isVisible() if (waiter) break await this.wait(1) count += 1000 diff --git a/test/helper/webapi.js b/test/helper/webapi.js index 7d01fb482..27cb816b6 100644 --- a/test/helper/webapi.js +++ b/test/helper/webapi.js @@ -1007,6 +1007,11 @@ module.exports.tests = function () { await I.waitForText('Dynamic text', 5, '//div[@id="text"]') }) + it('should wait for text with double quotes', async () => { + await I.amOnPage('/') + await I.waitForText('said: "debug!"', 5) + }) + it('should throw error when text not found', async () => { await I.amOnPage('/dynamic') await I.dontSee('Dynamic text')