0
0
Cypresstesting~10 mins

cy.type() for text input in Cypress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to type 'hello' into the input field with id 'username'.

Cypress
cy.get('#username').[1]('hello')
Drag options to blanks, or click blank then click option'
Atype
Bclick
Cselect
Dcheck
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'type' to enter text
Using 'select' which is for dropdowns, not text inputs
Using 'check' which is for checkboxes
2fill in blank
medium

Complete the code to type the email 'user@example.com' into the input with class 'email-input'.

Cypress
cy.get('.email-input').[1]('user@example.com')
Drag options to blanks, or click blank then click option'
Aclear
Bfocus
Csubmit
Dtype
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'clear' instead of 'type' to enter text
Using 'submit' which is for forms, not typing
Using 'focus' which only focuses the element
3fill in blank
hard

Fix the error in the code to type 'password123' into the input with name 'password'.

Cypress
cy.get('input[name="password"]').[1]('password123')
Drag options to blanks, or click blank then click option'
Aclick
Btype
Cselect
Dcheck
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' which only clicks the element
Using 'check' which is for checkboxes
Using 'select' which is for dropdowns
4fill in blank
hard

Fill both blanks to type 'admin' into the input with id 'user' and then press Enter.

Cypress
cy.get('#user').[1]('admin[2]')
Drag options to blanks, or click blank then click option'
Atype
B{enter}
C{esc}
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'type'
Using '{esc}' instead of '{enter}'
Not including the special key inside the string
5fill in blank
hard

Fill all three blanks to clear the input with id 'search', type 'query', and then press Enter.

Cypress
cy.get('#search').[1]().[2]('query[3]')
Drag options to blanks, or click blank then click option'
Aclear
Btype
C{enter}
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Not clearing the input before typing
Using 'click' instead of 'clear' or 'type'
Not including '{enter}' to simulate pressing Enter