File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1876,11 +1876,15 @@ class Playwright extends Helper {
18761876 * {{> type }}
18771877 */
18781878 async type ( keys , delay = null ) {
1879+ // Always use page.keyboard.type for any string (including single character and national characters).
18791880 if ( ! Array . isArray ( keys ) ) {
18801881 keys = keys . toString ( )
1881- keys = keys . split ( '' )
1882+ const typeDelay = typeof delay === 'number' ? delay : this . options . pressKeyDelay
1883+ await this . page . keyboard . type ( keys , { delay : typeDelay } )
1884+ return
18821885 }
18831886
1887+ // For array input, treat each as a key press to keep modified keys working.
18841888 for ( const key of keys ) {
18851889 await this . page . keyboard . press ( key )
18861890 if ( delay ) await this . wait ( delay / 1000 )
Original file line number Diff line number Diff line change @@ -713,6 +713,15 @@ describe('Playwright', function () {
713713 } )
714714 } )
715715
716+ describe ( '#type' , ( ) => {
717+ it ( 'should type national characters' , async ( ) => {
718+ await I . amOnPage ( '/form/field' )
719+ await I . fillField ( 'Name' , '' )
720+ await I . type ( 'Oprávněné' )
721+ await I . seeInField ( 'Name' , 'Oprávněné' )
722+ } )
723+ } )
724+
716725 describe ( '#waitForEnabled' , ( ) => {
717726 it ( 'should wait for input text field to be enabled' , ( ) =>
718727 I . amOnPage ( '/form/wait_enabled' )
You can’t perform that action at this time.
0 commit comments