Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions test/helper/Playwright_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down