Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to click a hidden button using Cypress.
Cypress
cy.get('#hidden-button').click({ [1]: true })
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'visible' instead of 'force' causes Cypress to wait for visibility.
Using 'hidden' is not a valid option for click.
✗ Incorrect
Using force: true tells Cypress to click the element even if it is hidden.
2fill in blank
mediumComplete the code to type text into a hidden input field using Cypress.
Cypress
cy.get('.hidden-input').type('Hello', { [1]: true })
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'visible' option prevents typing into hidden elements.
Forgetting to add the option causes Cypress to throw an error.
✗ Incorrect
The force: true option allows typing into hidden elements.
3fill in blank
hardFix the error in the code to check a hidden checkbox using Cypress.
Cypress
cy.get('#hidden-checkbox').check({ [1]: true })
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'visible' option causes Cypress to fail on hidden elements.
Omitting the option causes an error when element is hidden.
✗ Incorrect
Checking a hidden checkbox requires force: true to bypass visibility checks.
4fill in blank
hardFill both blanks to force clicking and typing into hidden elements.
Cypress
cy.get('.hidden-button').click({ [1]: true }); cy.get('.hidden-input').type('Test', { [2]: true });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different options for click and type causes errors.
Not using force option causes Cypress to fail on hidden elements.
✗ Incorrect
Both click and type need force: true to work on hidden elements.
5fill in blank
hardFill all three blanks to force checking, clicking, and typing on hidden elements.
Cypress
cy.get('#hidden-checkbox').check({ [1]: true }); cy.get('.hidden-button').click({ [2]: true }); cy.get('.hidden-input').type('Hello', { [3]: true });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'visible' or 'hidden' options instead of 'force'.
Omitting the option causes test failures on hidden elements.
✗ Incorrect
All actions require force: true to interact with hidden elements in Cypress.