In thinking of what the click() and submit() methods are in Selenium we first need to have a reasonable understanding of why they exist.
When working with web forms there are two things that you will do, click on form elements and submit the form. Along the way you might enter and clear text, select from drop-down option fields or attach certain files. Forms can be complex or simple, but as a minimum you’ll click on items and when done, submit the form.
Form elements such as Text Fields, Radio Buttons and Checkboxes are all clicked on in order to give them focus before typing or to change their state. The ‘Button’ form element is of course an element that can also be clicked on.
Whenever you want to simulate a user interacting with a form element, then use the click() method. This applies irrespective of whether the click is on a form element or a button, including the Submit button type. We also click on links.
Once you want to submit the form data to the server, you click on the Submit button. When doing so we then submit the form. As Selenium provides us a submit() method, we don’t need to click the Submit button.