diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index ad26d6e1d..4451b3f67 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 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) 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')