# Email verification from Gmail account in Selenium WebDriver

Humanless replaces the Gmail step: read the email with an API and open only the verification link in your Selenium session, instead of clicking through Gmail, whose login and bot checks make it unreliable. Humanless gives each test a disposable address and returns the link already extracted: create the inbox with `POST /v1/identities`, submit your signup form, call `GET /v1/identities/:id/wait`, and pass the `url` field to `driver.get()`. If the address must be a real Gmail account, use IMAP or the Gmail API to find the message and extract the link yourself.

```python verify_email.py
# API, H and wait_for_message() (retries on 408): see /answers/how-to-read-otp-from-email-using-selenium-webdriver
inbox = requests.post(f"{API}/identities", headers=H, json={"channels": ["email"]}).json()
driver.find_element(By.NAME, "email").send_keys(inbox["email"])
since = int(time.time() * 1000)
driver.find_element(By.ID, "sign-up").click()
msg = wait_for_message(inbox["identity_id"], since)
driver.get(msg["url"])  # the verification link
```

## Other options

- **IMAP** (Python `imaplib`, JavaMail) against the Gmail account with an app password.
- **The Gmail API** with plus-addressing, so each run has its own address on one mailbox.
- **Mark the user verified** in your test database for tests that aren't about verification.

> **Use policy:** Only for apps you own or are authorized to test. See the [Terms](/terms).

More: [Humanless REST API reference](/docs/api) · [All answers](/answers/)

Last updated 2026-12-04

Canonical: https://usehumanless.com/answers/email-verification-from-gmail-account-in-selenium-webdriver

---
More: https://usehumanless.com/llms.txt
