Selenium Email Testing & Verification

How to test email verification, OTP, and password reset flows in Selenium WebDriver. Create a disposable inbox via API, trigger your app, poll for the message, extract the link or code. Java, Python, and C# examples with no SMTP server required.

Frequently Asked Questions

How do I test email sending in Selenium?

Use a disposable inbox API like sed.sh. Generate a unique email address per test, trigger the action that sends an email, then poll the API for the message. Works with Python (pytest), Java (JUnit 5), and C# (NUnit).

Do I need a real email server for Selenium email testing?

No. sed.sh gives you a real @sed.sh address you can receive mail to, accessible via REST API. No SMTP server, no Mailhog, no test relay needed.

How do I avoid flaky email tests in Selenium?

Use a unique email address per test run (never reuse between runs), poll every 2 seconds with a 30-second timeout rather than a fixed sleep, and assert on specific content — subject line or link — not just that a message arrived.

How much does sed.sh cost for email testing?

$0.0012 per email received. A test suite of 1,000 email tests costs $1.20. No subscription, no monthly fee. Volume discounts apply automatically at 5,000 and 10,000 emails.

How long does it take for a test email to arrive?

Typically 1–3 seconds via AWS SES. Poll every 2 seconds with a 30-second timeout — this is safe for virtually all production email systems. If your app sends via a queue, add a 5–10 second buffer.

Can I run Selenium email tests in parallel?

Yes. Create one inbox per test worker — each has a unique code, so there is no cross-contamination. sed.sh supports up to 100 concurrent active inboxes. Use pytest-xdist for Python, parallel JUnit 5 config for Java, or NUnit Parallelizable for C#. Always delete inboxes in teardown.

Does sed.sh work with Selenium Grid or BrowserStack?

Yes. sed.sh is a REST API your test code calls directly, independent of where Selenium runs. Whether you use local ChromeDriver, Selenium Grid, BrowserStack, or Sauce Labs, the inbox API calls are identical.