I’m trying to create a Selenium WebDriver test for Google account login using Java, but my script keeps crashing when it tries to locate the password input field. The automation works fine for entering the email address, but then it throws a NoSuchElementException when searching for the password element.
The error message shows it can’t find an element with id “Passwd”. I’m using Firefox driver and getting a timeout after just 17 milliseconds. My script runs on Windows 7 with Java 8 and Selenium version 2.47.1.
Has anyone encountered this issue before? I think the problem might be that Google’s login flow has changed and now uses a two-step process where the password field only appears after you enter your email. Maybe I need to add some wait conditions or use different element locators?
Any suggestions on how to handle this modern Google sign-in process with Selenium would be really helpful.
Yeah, that’s definitely the two-step login issue. I spent weeks pulling my hair out over this one lol. Try driver.findElement(By.name("password")) instead of the ID - Google constantly changes those. Also make sure you’re actually clicking Next after entering the email, don’t just hit enter. Sometimes the DOM needs a second to refresh.
You’re right - Google switched to two-step auth and it broke my test suite overnight about a year ago. Same exact issue. The password field doesn’t exist until you submit the email and the page transitions. I fixed it by adding WebDriverWait after clicking the email submit button. Use WebDriverWait with ExpectedConditions.presenceOfElementLocated() to wait for the password field to load before interacting with it. Also, Google changes their element IDs and class names constantly, so switch to xpath with text content or CSS selectors targeting input types instead. That 17ms timeout means your implicit wait isn’t set up right either.
Had the same issue after Google changed their login flow. You need to click “Next” after entering the email and wait for the password field to actually load. Use explicit waits with 10-15 seconds instead of implicit waits - works way better. Your Selenium version is pretty old too. Google’s login pages use dynamic loading now and newer Selenium versions handle this much better. I upgraded to 3.x and it fixed most of the flaky Google auth issues.