Complete the code to select a button with the class 'submit-btn' using Cypress.
cy.get('[1]').click()
The cy.get() command selects elements by CSS selector. Using .submit-btn selects elements with the class submit-btn.
Complete the code to select an input element with the attribute name='email' using Cypress.
cy.get('[1]').type('user@example.com')
The selector input[name='email'] selects an input element with the attribute name equal to email.
Fix the error in the code to select a button with text 'Submit' using Cypress.
cy.contains('[1]').click()
cy.contains()The cy.contains() command takes the text content directly as a string, so just use 'Submit'.
Fill both blanks to select all list items inside a <ul> with class 'menu' and check their count.
cy.get('[1]').should('[2]', 5)
- instead of its
- children
ul.menu li selects all li elements inside a ul with class menu. The assertion have.length checks the number of matched elements.
Fill all three blanks to select an input with id 'search', type 'cypress', and verify its value.
cy.get('[1]').[2]('cypress').should('[3]', 'cypress')
fill() instead of type()cy.get('#search') selects the input by ID. type('cypress') enters text. should('have.value', 'cypress') asserts the input's value.