 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Selenium Webdriver submit() vs click().
The click() and submit() functions are quite similar in terms of functionalities. However there are minor differences. Let us discuss some differences between them.
The submit() function is applicable only for <form> and makes handling of form easier. It can be used with any element inside a form. The click() is only applicable to buttons with type submit in a form.
The submit() function shall wait for the page to load however the click() waits only if any explicit wait condition is provided. If a form has a submit of type button, the submit() method cannot be used. Also, if a button is outside <form>, then submit() will not work.
Thus we see that click() works for both type buttons irrespective of the fact that the button is inside or outside of <form>. Let us take up the below form for implementation.

Example
Code Implementation with submit().
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class SubmitForm{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "https://www.facebook.com/";       driver.get(url);       driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);       // identify elements       driver.findElement(By.id("email")).sendKeys("abc@gmail.com");       driver.findElement(By.id("pass")).sendKeys("123456");       // submitting form with submit()       driver.findElement(By.id("pass")).submit();       driver.quit()    } }  Example
Code Implementation with click().
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class ClickForm{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "https://www.facebook.com/";       driver.get(url);       driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);       // identify elements       driver.findElement(By.id("email")).sendKeys("abc@gmail.com");       driver.findElement(By.id("pass")).sendKeys("123456");       // submitting form with click()       driver.findElement(By.name("login")).click();       driver.quit()    } }