Selenium + plop.email

Add email verification to your Selenium tests. Works with Java, Python, C#, and all Selenium language bindings.

Selenium Documentation

Features

Language Agnostic

Use with any Selenium binding—Java, Python, C#, Ruby, JavaScript.

REST API Integration

Fetch emails using standard HTTP libraries in your test code.

Grid Compatible

Works with Selenium Grid for parallel and distributed testing.

Cross-Browser Testing

Verify email flows across Chrome, Firefox, Safari, Edge.

Setup

# Python example
pip install selenium requests

# Java example (add to pom.xml)
<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
</dependency>

# Set environment variable
export PLOP_API_KEY=your_api_key

Python Selenium Example

Test email flows with Selenium and Python.

Python Selenium Exampletypescript
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import requests
import time
import os

def test_signup_email():
    driver = webdriver.Chrome()
    test_email = f"selenium+{int(time.time())}@in.plop.email"

    try:
        # Complete signup flow
        driver.get("https://yourapp.com/signup")
        driver.find_element(By.NAME, "email").send_keys(test_email)
        driver.find_element(By.NAME, "password").send_keys("SecurePass123!")
        driver.find_element(By.CSS_SELECTOR, "button[type='submit']").click()

        # Wait for confirmation page
        WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, "success-message"))
        )

        # Fetch email via plop API
        time.sleep(2)  # Allow email delivery
        response = requests.get(
            "https://api.plop.email/v1/messages/latest",
            params={"to": test_email},
            headers={"Authorization": f"Bearer {os.environ['PLOP_API_KEY']}"}
        )
        email = response.json()

        # Verify email content
        assert "Welcome" in email["subject"]
        assert "Get Started" in email["htmlContent"]

    finally:
        driver.quit()

Java Selenium Example

Email testing with Selenium and Java.

Java Selenium Exampletypescript
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import java.net.http.*;
import java.net.URI;

public class EmailTest {
    public void testPasswordReset() throws Exception {
        WebDriver driver = new ChromeDriver();
        String testEmail = "selenium+" + System.currentTimeMillis() + "@in.plop.email";

        try {
            // Request password reset
            driver.get("https://yourapp.com/forgot-password");
            driver.findElement(By.name("email")).sendKeys(testEmail);
            driver.findElement(By.cssSelector("button[type='submit']")).click();

            Thread.sleep(3000); // Wait for email

            // Fetch email via API
            HttpClient client = HttpClient.newHttpClient();
            HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://api.plop.email/v1/messages/latest?to=" + testEmail))
                .header("Authorization", "Bearer " + System.getenv("PLOP_API_KEY"))
                .build();

            HttpResponse<String> response = client.send(request,
                HttpResponse.BodyHandlers.ofString());

            // Parse and verify
            assert response.body().contains("Reset");

        } finally {
            driver.quit();
        }
    }
}

Tips

  • Use explicit waits for email delivery instead of Thread.sleep()
  • Generate unique emails using timestamps or UUIDs
  • Store PLOP_API_KEY in CI secrets or environment variables
  • Consider using a Page Object pattern for email verification methods

Related Integrations

Start testing with Selenium

Add email verification to your Selenium tests in minutes.