Hello @User, this was the error I was facing when I was playing with selenium. Most of the times we get this error because we are trying to use a common element's name such as class name. Id is always distinct for all the web elements. Try using ID all the time and when there is no ID use xpath.
Here in gmail they have seperate class name for password know as 'password'. Here is the screenshot that I have shared.
You can simply use the name field here like this:
WebElement password = driver.findElement(By.name("password"));
WebElement button1 = driver.findElement(By.className("CwaK9"));
Here we are first finding element by name i.e. password
then we are clicking on the submit button that button we are finding using ClassName here i.e. "CwaK9"
then we are clicking it. Remember to make the browser wait as you don't want the browser to close before you feed the information.
Hope this helps.