The Simplest Way to Make Kong and Selenium Work Like They Should
Teams use kong and selenium together to test web apps behind API management layers. Selenium drives real browser checks while Kong manages routing, login checks, and rate rules. This pair helps teams catch broken routes before code reaches real users. A browser test clicks through the app and sends traffic through Kong. Kong checks the request headers, tokens, and rate rules before passing traffic forward. When both tools match their settings, tests run fast and mirror real user flows. How tr
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams use kong and selenium together to test web apps behind API management layers. Selenium drives real browser checks while Kong manages routing, login checks, and rate rules.
This pair helps teams catch broken routes before code reaches real users. A browser test clicks through the app and sends traffic through Kong. Kong checks the request headers, tokens, and rate rules before passing traffic forward. When both tools match their settings, tests run fast and mirror real user flows.
How traffic and logins flow between kong and selenium
A Selenium grid runs headless browsers on worker nodes inside your test network. Each browser loads your front-end web app and triggers API calls to backend services. Those calls hit Kong first instead of reaching backend services on direct ports.
Kong checks every browser request against active plugins for login tokens and role scopes. If a Selenium script logs in as a test user, it gets a token. The browser stores that token in a cookie or local storage for the next steps. Kong reads the token on each request and passes valid calls to the backend service.
Data then flows back from the backend service through Kong to the test browser. Selenium checks the page text, status responses, and screen elements to confirm the test passed. This setup tests both the app code and the edge routing rules at once.
Common failure modes and how to scope test roles
Many teams fail by using one shared admin account for all Selenium browser tests. When fifty browser workers use the same key, Kong blocks them with rate limits. Shared keys also hide which test worker caused an error in the service logs.
Another bad habit is turning off Kong login checks in the test network. Teams do this to make browser scripts run faster without login steps. This hides broken token rules until you push the settings to live users.
End-to-End Encryption + Kong Security Plugins: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Instead, create unique test roles with strict permissions for each Selenium test suite. Give each worker node its own login profile and scope it to test data only. Set up Kong route rules so test keys can never read or change live data. Mask sensitive fields like emails, phone numbers, and card numbers in test responses. Masking rewrites matched fields in results so test logs stay clean and safe.
Keeping browser tests fast and reliable
Browser tests often fail when network paths between Selenium nodes and Kong change. Keep your Selenium grid inside the same private network zone as your test Kong instance. This cuts down network lag and stops false timeouts during heavy test runs.
Track every test run by passing a custom request header from the browser script. Kong can read this header and write it into the central system logs. When a test fails, your team can match the browser error to the exact route log. Rotate your test user keys on a regular schedule to keep the test setup clean.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Why does Kong block my Selenium test runs?
Kong blocks Selenium when many browser workers share one IP address or user key. This triggers rate limit rules or bot checks. Give each test worker a distinct test token and adjust rate rules for test routes.
Should Selenium bypass Kong during browser testing?
No, bypassing Kong skips key checks like CORS headers, token rules, and route paths. Always run browser traffic through Kong so your tests match real user visits.
How do we handle short token lifetimes in long Selenium suites?
Have your Selenium script log in fresh before each test file starts. This fetches a new token through the standard login flow so tokens do not expire mid-test.
Related guides
In this post