Selenium Webdriver submit() vs click()


Let’s say I have an input in a form (looks like a button and interacts like a button) which generates some data (well, the server generates the data based on the form parameters, but for the user, the button does it 🙂 )based on the parameters in the form.

When I use click(), the whole process hangs (it actually freezes, no exceptions or errors).

From the Selenium website:

// Now submit the form. WebDriver will find the form for us from the element

So WebDriver has a submit() method. Is there any difference, logic wise, between using a click() on a button or submit() ?

  • You must to post comments

The submit() function is there to make life easier. You can use it on any element inside of form tags to submit that form.

You can also search for the submit button and use click().

So the only difference is click() has to be done on the submit button and submit() can be done on any form element.

It’s up to you.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.