The Simplest Way to Make Bitbucket and Selenium Work Like They Should
Teams use bitbucket and selenium together to run browser tests on every code push. Bitbucket starts a build job, and Selenium tests the web app in a browser. This workflow catches broken pages before bad code reaches real users in production. Developers get fast feedback right inside their pull requests during daily code reviews. How bitbucket and selenium share roles and data Bitbucket stores your source code and runs build jobs when someone pushes changes. The build runner starts a contain
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 bitbucket and selenium together to run browser tests on every code push. Bitbucket starts a build job, and Selenium tests the web app in a browser.
This workflow catches broken pages before bad code reaches real users in production. Developers get fast feedback right inside their pull requests during daily code reviews.
How bitbucket and selenium share roles and data
Bitbucket stores your source code and runs build jobs when someone pushes changes. The build runner starts a container that holds your test scripts and browser drivers.
Selenium takes those scripts and opens a real browser to click buttons and forms. The build job needs keys and login details to reach the staging web app.
Teams store these secrets inside Bitbucket repo settings as hidden variables for the runner. When the job starts, Bitbucket passes those variables into the test container memory.
Selenium reads the login values and fills out the login page of the app. It also needs network permission to reach the staging server or a remote grid.
Once the tests finish, Selenium writes a report file with pass or fail results. Bitbucket reads that report file and shows the status on the commit page.
Common failure modes and how to scope permissions
Many teams use one shared admin account for all their automated browser tests. If that password leaks in a build log, attackers can reach the whole app.
Broad API tokens also cause big security risks inside shared code repos. Any developer who edits the build script can print those secrets to the screen.
End-to-End Encryption + Bitbucket Pipelines Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Another common issue is unlogged database queries or actions made during browser test runs. When ten jobs run at once, nobody knows which test changed the staging data.
To fix this, give each test suite a small role with limited app rights. Create separate test users that can only touch the pages they need to check.
Lock down network paths so the browser grid can only reach the staging server. Never let test runners talk to production databases or internal admin tools.
Rotate your test account keys often and clear out old data after every run. Keep secret variables locked to protected branches so random pull requests cannot read them.
Running browser tests at scale in build pipelines
Browser tests take much more memory and time than simple unit test scripts. Running a full browser inside a tiny build container often causes random crashes.
Teams solve this by sending browser commands to a separate grid of worker nodes. The Bitbucket runner only runs the test logic and sends actions over the network.
This split setup keeps the build runner fast and avoids memory spikes during tests. You can run many browser tabs at the same time to finish checks faster.
Make sure each parallel test uses its own login user and isolated test data. If two browser sessions share one user, one test will log the other out.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
How do I run headless browsers in a Bitbucket pipeline?
Pick a build image that includes a browser and matching driver already set up. Start the browser in headless mode so it runs without a screen display.
Where should I store test passwords for Selenium scripts?
Store all test passwords in Bitbucket secured variables rather than inside your code files. Restrict those variables to protected branches so outside forks cannot read your secrets.
Why do my Selenium tests pass on my laptop but fail in Bitbucket?
Cloud build runners are often slower than laptops and lack a real screen size. Add explicit waits for page elements and set a fixed window size on startup.
Related guides
In this post