--- title: submit comments: true description: '' --- Submit a form. # Syntax ```javascript .submit() .submit(options) ``` ## Usage `.submit()` requires being chained off another cy command that *yields* a form. **{% fa fa-check-circle green %} Valid Usage** ```javascript cy.get('form').submit() // Submit a form ``` **{% fa fa-exclamation-triangle red %} Invalid Usage** ```javascript cy.submit() // Errors, cannot be chained off 'cy' cy.get('input').submit() // Errors, 'input' does not yield a form ``` ## Arguments **{% fa fa-angle-right %} options** ***(Object)*** Pass in an options object to change the default behavior of `.submit()`. ## Yields `.submit()` yields the form that was submitted. ## Timeout `.submit()` will continue to try to submit the form for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) # Example ## Submit a form **Submit can only be called on a single form.** ```html
``` ```javascript cy.get('#contact').submit() ``` # Command Log **Submit a form** ```javascript cy.route('POST', '/users', 'fixture:user').as('userSuccess') cy.get('form').submit() ``` The commands above will display in the command log as:
When clicking on `submit` within the command log, the console outputs the following:

# See also
- [click](https://on.cypress.io/api/click)