Testing / Selenium Interview questions
How can you integrate Selenium tests into a CI/CD pipeline?
Because Selenium needs a real browser and matching driver, most CI setups either run tests headless on the CI runner directly, or point RemoteWebDriver at a containerized Selenium Grid so the pipeline doesn't depend on whatever browser happens to be preinstalled on the build agent.
# GitHub Actions example - uses: actions/setup-java@v4 - run: mvn test -Dheadless=true - uses: actions/upload-artifact@v4 if: always() with: name: test-report path: target/surefire-reports/
A common, reproducible pattern runs Selenium Grid via Docker Compose (a hub/node or the newer standalone image) as a service in the pipeline, so the exact same browser versions are used locally and on CI rather than drifting apart over time. Uploading the test framework's report directory (Surefire, ExtentReports output) as a build artifact with if: always() ensures a failing run still leaves behind logs and screenshots to debug, rather than just a red build with no further detail.
More Related questions...