Difference between submit() vs click() in Selenium Webdriver

0 votes
When testing forms, we can use either submit() or click() according to Selenium documentation. But when I use click(), the form submission hangs. Is there any diference that I should be aware of? Atleast logically because one of them is not working.
May 24, 2018 in Selenium by eLiJha
• 710 points
1,547 views

1 answer to this question.

0 votes
The submit() function is specifically for forms and makes things simpler. It can be used inside forms on elements, or form tags to submit that form.
Or else the obvious way is to use click() function after searching for that submit button.

So the only difference being: click() should be done on submit button and submit() can be done anywhere on the form element. The choice is yours.
http://docs.seleniumhq.org/docs/03_webdriver.jsp#user-input-filling-in-forms
answered May 24, 2018 by sniffy_god
• 760 points

Related Questions In Selenium

0 votes
1 answer

Differences between Implicit wait Vs. Explicit wait in selenium webdriver

Implicit Wait - It instructs the web driver ...READ MORE

answered Apr 9, 2018 in Selenium by ghost
• 1,790 points
1,255 views
0 votes
1 answer

What is the difference between findElement and findElements in Selenium Webdriver?

Hi Nilaabh, Selenium Webdriver uses findElement and ...READ MORE

answered May 8 in Selenium by Anvi
• 11,690 points
191 views
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
403 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
758 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
400 views
+1 vote
2 answers
0 votes
2 answers