If you submit using any element of Form, it will automatically find button with type ‘submit’ of form and click on it.
Submit can be done on any form item and click has to be done Button with type Submit
Selenium WebDriver has one special method to submit any form and that method name Is submit(). submit() method works same as clicking on submit button.
.click() method :
You can use .click() method to click on any button. There is no restriction for click buttons.
That means element’s type = “button” or type = “submit”, .click() method will works for both.
If button is inside <form> tag or button is outside <form> tag, the click() method will work.
.submit() method :
we can use .submit() method for only submit form after click on button.
That means element’s type = “submit” and button should be inside <form> tag, then only submit() will work.
If element’s type = “button” means submit() will not work.
If button outside of the <form> tag means submit() will not work
For Example, Submit() will work if submit button should be inside <form> tag and element type=”submit” as below
But click() method will work for all buttons in webpage with out any restrictions.