Selenium DevOps & Deployment 2 — Questions and Answers
Question 1: Which Jenkins plugin is most commonly used to trigger Selenium tests after a Maven build?
- Maven Integration Plugin (Correct answer)
- Selenium Plugin
- Post-Build Actions with Maven
- TestNG Results Plugin
Correct answer: Maven Integration Plugin
The Maven Integration Plugin allows Jenkins to execute Maven goals, including running Selenium tests packaged with Surefire or Failsafe.
Question 2: In a CI/CD pipeline, what is the primary purpose of running Selenium tests in 'headless' mode?
- To speed up test execution on local machines
- To run tests on servers without a display environment (Correct answer)
- To bypass browser security restrictions
- To enable parallel test execution
Correct answer: To run tests on servers without a display environment
Headless mode allows browsers to run without a graphical display, making Selenium tests viable on CI servers that lack a GUI.
Question 3: Which tool is used to provide a virtual display for Selenium tests on Linux CI servers when not using headless mode?
- X11 Forwarding
- Xvfb (X Virtual Framebuffer) (Correct answer)
- VirtualBox Guest Additions
- Wayland Compositor
Correct answer: Xvfb (X Virtual Framebuffer)
Xvfb creates a virtual framebuffer that simulates a display, allowing GUI browsers to run on headless Linux servers.
Question 4: What Docker command correctly mounts a shared memory volume to prevent Selenium Chrome crashes in containers?
- docker run --shm-size=2g selenium/standalone-chrome (Correct answer)
- docker run --memory=2g selenium/standalone-chrome
- docker run --privileged selenium/standalone-chrome
- docker run --cap-add=SYS_ADMIN selenium/standalone-chrome
Correct answer: docker run --shm-size=2g selenium/standalone-chrome
Chrome uses /dev/shm for shared memory; without sufficient shm-size, it crashes in Docker containers.
Question 5: In GitHub Actions, which environment variable provides the workspace path where test artifacts should be stored?
- $GITHUB_WORKSPACE (Correct answer)
- $RUNNER_TEMP
- $GITHUB_OUTPUT
- $ACTIONS_CACHE_URL
Correct answer: $GITHUB_WORKSPACE
$GITHUB_WORKSPACE is the directory where the repository is checked out and where test artifacts are typically written.
Question 6: Which Selenium Grid component registers available browser nodes and routes test sessions to them?
- Node
- Hub
- Router
- Distributor (Correct answer)
Correct answer: Distributor
In Selenium Grid 4, the Distributor tracks available nodes and assigns new sessions to matching nodes based on capabilities.
Question 7: What is the recommended approach for managing WebDriver binaries in a CI/CD pipeline to avoid version mismatch issues?
- Commit WebDriver binaries to the repository
- Use WebDriverManager to auto-download matching drivers (Correct answer)
- Pin a specific driver version in the pipeline script
- Use only Selenium Grid which manages drivers centrally
Correct answer: Use WebDriverManager to auto-download matching drivers
WebDriverManager (Bonigarcia) automatically downloads the correct WebDriver version matching the installed browser, eliminating manual management.
Which Jenkins plugin is most commonly used to trigger Selenium tests after a Maven build?