Selenium DevOps & Deployment 3 — Questions and Answers
Question 1: Which Selenium Grid 4 topology mode runs the Hub and Node as a single process on one machine?
- Distributed Mode
- Standalone Mode (Correct answer)
- Relay Mode
- Dynamic Mode
Correct answer: Standalone Mode
Standalone Mode combines all Grid components into a single process, ideal for development or small-scale CI environments.
Question 2: When integrating Selenium with Docker Compose, what network setting ensures containers can communicate using service names as hostnames?
- network_mode: host
- Defining a shared custom network bridge (Correct answer)
- Using --link flags between containers
- Setting SELENIUM_HUB_HOST environment variable
Correct answer: Defining a shared custom network bridge
Docker Compose automatically creates a default bridge network where services can resolve each other by service name as hostname.
Question 3: In a Jenkins declarative pipeline, which stage configuration runs Selenium tests only when merging to the main branch?
- when { branch 'main' } (Correct answer)
- condition { branch == 'main' }
- if (env.BRANCH_NAME == 'main')
- only_on: main
Correct answer: when { branch 'main' }
The `when { branch 'main' }` directive in declarative pipelines conditionally executes a stage based on the current branch name.
Question 4: What is the purpose of the '--no-sandbox' Chrome argument often used in Dockerized Selenium tests?
- Improves JavaScript execution speed
- Disables Chrome's sandbox security for root user containers (Correct answer)
- Enables headless rendering mode
- Allows cross-origin requests without CORS restrictions
Correct answer: Disables Chrome's sandbox security for root user containers
Chrome's sandbox requires kernel features unavailable to root users in containers; --no-sandbox disables it to allow Chrome to start.
Question 5: Which AWS service is commonly used to run distributed Selenium tests in the cloud without managing infrastructure?
- AWS Lambda
- AWS Device Farm (Correct answer)
- Amazon ECS
- AWS Batch
Correct answer: AWS Device Farm
AWS Device Farm provides managed browser and mobile testing infrastructure, supporting Selenium WebDriver tests without server management.
Question 6: In a GitLab CI pipeline, what artifact configuration saves Selenium test screenshots for failed tests?
- artifacts: paths: [screenshots/] when: on_failure (Correct answer)
- save: screenshots/ on: failure
- store_artifacts: path: screenshots when: failed
- upload: path: screenshots trigger: failure
Correct answer: artifacts: paths: [screenshots/] when: on_failure
GitLab CI's artifacts configuration with `when: on_failure` uploads specified paths only when the job fails.
Question 7: Which Maven plugin phase is typically used to start and stop a Selenium test server (like a web app) surrounding integration tests?
- test and post-test
- verify and post-verify
- pre-integration-test and post-integration-test (Correct answer)
- compile and package
Correct answer: pre-integration-test and post-integration-test
Maven's pre-integration-test and post-integration-test phases are designed to start and stop test servers that integration tests depend on.
Which Selenium Grid 4 topology mode runs the Hub and Node as a single process on one machine?