From b3408dc7965b02f5cc2c72df0ef17bdbb3b23492 Mon Sep 17 00:00:00 2001 From: Jaromir Obr Date: Wed, 29 Oct 2025 08:39:32 +0000 Subject: [PATCH 1/2] fix(playwright): always use keyboard.type for strings, add national characters test (#5279) --- lib/helper/Playwright.js | 6 +++++- test/helper/Playwright_test.js | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index ad26d6e1d..fe3a02ccb 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -1876,11 +1876,15 @@ class Playwright extends Helper { * {{> type }} */ async type(keys, delay = null) { + // Always use page.keyboard.type for any string (including single character and national characters). if (!Array.isArray(keys)) { keys = keys.toString() - keys = keys.split('') + const typeDelay = typeof delay === 'number' ? delay : this.options.pressKeyDelay + await this.page.keyboard.type(keys, { delay: typeDelay }) + return } + // For array input, treat each as a key press to keep modified keys working. for (const key of keys) { await this.page.keyboard.press(key) if (delay) await this.wait(delay / 1000) diff --git a/test/helper/Playwright_test.js b/test/helper/Playwright_test.js index 9f5d5566a..f955b524f 100644 --- a/test/helper/Playwright_test.js +++ b/test/helper/Playwright_test.js @@ -713,6 +713,15 @@ describe('Playwright', function () { }) }) + describe('#type', () => { + it('should type national characters', async () => { + await I.amOnPage('/form/field') + await I.fillField('Name', '') + await I.type('Oprávněné') + await I.seeInField('Name', 'Oprávněné') + }) + }) + describe('#waitForEnabled', () => { it('should wait for input text field to be enabled', () => I.amOnPage('/form/wait_enabled') From 1dadfeb2c8b7decfa68679231ec897e4d2e77e87 Mon Sep 17 00:00:00 2001 From: Jaromir Obr Date: Thu, 30 Oct 2025 10:49:16 +0100 Subject: [PATCH 2/2] fix(playwright): improved a comment (#5279) --- lib/helper/Playwright.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index fe3a02ccb..4451b3f67 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -1884,7 +1884,7 @@ class Playwright extends Helper { return } - // For array input, treat each as a key press to keep modified keys working. + // For array input, treat each as a key press to keep working combinations such as ['Control', 'A'] or ['T', 'e', 's', 't']. for (const key of keys) { await this.page.keyboard.press(key) if (delay) await this.wait(delay / 1000)