Quick interview answer
Containerise the suite, use selenium-docker or Selenium Grid via docker-compose for local parallelism, and switch to a cloud grid (BrowserStack/LambdaTest/Sauce) by changing only the RemoteWebDriver URL and capabilities.
Detailed explanation
The image pins JDK/Maven and the framework; the grid runs as separate containers so browser versions are reproducible. docker-compose brings up hub plus dynamic nodes; CI runs the suite container on the same network. Cloud grids are configured through capabilities and a secret-based URL, so environment selection stays a config concern, never a code change. Video and logs come from the grid rather than the framework.
1services:2 selenium-hub:3 image: selenium/hub:4.214 chrome:5 image: selenium/node-chromium:4.216 shm_size: 2gb7 environment: [ SE_EVENT_BUS_HOST=selenium-hub, SE_NODE_MAX_SESSIONS=4 ]Real-world example
Containerising the grid removed 'works on my machine' browser-version failures entirely.
Interview tip
Stress shm_size and pinned browser versions — those are the two things that bite in real containers.