Selenium Webdriver submit() vs click()

Click method:

Click method will perform just a click operation. Click method will click irrespective of the element it could be in Burton or it could be a radio button or checkbox.

Submit method:

Submit method will submit the form; with the development of ajax, the submit matter is depreciated/ declined in Popularity.

Case 1 : click vs Submit

form-submit-button-selenium
submit-click-selenium

In the above HTML code, the submit button is present inside a form and when the submit button is clicked the phone will be submitted.

So instead of clicking the submit button we can use submit method.

Case 2: click vs Submit

without-submit-button

click-submit-selenium-no-form

In the above HTML code, there is no form, if we called submit method here then it will not work. We have to use the click method only.

To use a submit method not only form is required but also the type should be submit for the submit button.

About Author :

I am Pavankumar, Having 8.5 years of experience currently working in Video/Live Analytics project.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions