Certified Professional Selenium Tester (CPST) — Questions and Answers
Question 1: What Selenium Grid 4 feature allows administrators to observe real-time node status, session counts, and queue depth via a browser interface?
- RemoteWebDriver dashboard
- Grid UI at /ui (Correct answer)
- Selenium IDE recorder
- WebDriver BiDi console
Correct answer: Grid UI at /ui
Selenium Grid 4 ships with a built-in UI accessible at /ui that shows live node registrations, active sessions, and the pending session queue.
Question 2: What does StaleElementReferenceException indicate in a Selenium test?
- The element's text content is empty
- The element was found but is not interactable
- The element reference is no longer valid because the DOM was updated (Correct answer)
- The locator strategy returned multiple elements
Correct answer: The element reference is no longer valid because the DOM was updated
StaleElementReferenceException occurs when the DOM refreshes after an element is located, making the stored reference obsolete.
Question 3: Which security measure is essential for protecting Selenium Testing Certification digital systems?
- Using simple passwords
- Disabling firewalls
- Implementing multi-factor authentication (Correct answer)
- Sharing login credentials
Correct answer: Implementing multi-factor authentication
Multi-factor authentication adds extra layers of security beyond passwords, significantly reducing unauthorized access risk.
Question 4: How does Continuous Integration (CI) benefit Selenium test execution?
- It delays defect detection
- It restricts test execution frequency
- It automates test execution and ensures early defect detection (Correct answer)
- It eliminates automated testing
Correct answer: It automates test execution and ensures early defect detection
Continuous Integration (CI) integrates automated Selenium test execution into the development pipeline. This means tests are run automatically every time new code is committed, providing immediate feedback on the health of the application. The primary benefit is the early and consistent detection of defects, allowing developers to address issues quickly before they become more complex and costly to fix.
Question 5: When evaluating file upload functionality in a Selenium test on a web application, what is the correct approach?
- Use Actions class to drag and drop a file path
- Skip file upload tests as they cannot be automated
- Use Robot class to interact with the OS file dialog
- Send the file path as text to the hidden file input element using sendKeys() (Correct answer)
Correct answer: Send the file path as text to the hidden file input element using sendKeys()
Sending the local file path directly to the file input element using sendKeys() bypasses the OS dialog and works reliably across browsers.
Question 6: What Helm chart is officially provided by the Selenium project for deploying Selenium Grid on Kubernetes?
- selenium/k8s-grid
- selenium/selenium-server
- seleniumhq/selenium-grid (Correct answer)
- docker-selenium/chart
Correct answer: seleniumhq/selenium-grid
The official Helm chart is maintained at seleniumhq/selenium-grid and supports deploying Hub, Router, Distributor, and nodes on Kubernetes.
Question 7: Which assertion approach is most appropriate when a Selenium test validates that an API response contains a specific nested JSON field?
- Convert the response to XML before asserting
- Assert the entire response string matches exactly
- Use JSONPath expressions to extract and assert the specific field value (Correct answer)
- Assert only the HTTP status code
Correct answer: Use JSONPath expressions to extract and assert the specific field value
JSONPath expressions allow precise navigation and extraction of specific fields within nested JSON structures for targeted assertions.
Question 8: When using Selenium Grid in a corporate network, which security measure is most critical to implement first?
- Increase session timeout to 24 hours
- Run the Grid Hub on localhost only
- Enable authentication on the Grid Hub endpoint to prevent unauthorized node registration and job submission (Correct answer)
- Switch all nodes to use Chrome instead of Firefox
Correct answer: Enable authentication on the Grid Hub endpoint to prevent unauthorized node registration and job submission
An unauthenticated Grid Hub allows any actor on the network to submit arbitrary browser sessions and potentially exfiltrate data or execute malicious scripts.
Question 9: What is the primary advantage of using a Trie over a HashMap for storing Selenium CSS selector strings with common prefixes?
- Tries use less memory than HashMaps
- Tries are simpler to implement
- Tries enable prefix-based search and autocomplete in O(m) where m is prefix length (Correct answer)
- Tries have O(1) exact lookup
Correct answer: Tries enable prefix-based search and autocomplete in O(m) where m is prefix length
Tries share common prefix nodes among stored strings, enabling efficient prefix searches that HashMaps cannot do natively.
Question 10: Which Selenium feature allows tests to run across multiple browsers simultaneously?
- RemoteWebDriver alone
- TestNG annotations
- Selenium IDE
- Selenium Grid (Correct answer)
Correct answer: Selenium Grid
Selenium Grid distributes test execution across multiple nodes running different browsers and operating systems in parallel.
Question 11: When integrating API calls into Selenium tests, what is the primary advantage of using APIs for test data setup instead of UI flows?
- API calls are faster and more reliable than UI interactions (Correct answer)
- APIs automatically generate test reports
- APIs produce more accurate screenshots
- APIs eliminate the need for assertions
Correct answer: API calls are faster and more reliable than UI interactions
Using APIs for test data setup is significantly faster than navigating through the UI and avoids flaky UI-dependent preconditions.
Question 12: What is the correct XPath expression to navigate to the parent element of a located <input> node?
- //input/ancestor
- //input/child::*
- //input/preceding::*
- //input/parent::* (Correct answer)
Correct answer: //input/parent::*
The parent:: axis in XPath selects the immediate parent node of the current element.
Question 13: What is the risk of storing test credentials in plain text inside a Selenium test file committed to version control?
- It causes WebDriver session timeouts
- It slows down test execution due to file size
- Selenium cannot read plain text files for credentials
- Credentials can be exposed publicly, enabling unauthorized access to test or production systems (Correct answer)
Correct answer: Credentials can be exposed publicly, enabling unauthorized access to test or production systems
Plain-text credentials in source control can be leaked via repository access, history exposure, or accidental public repo pushes.
Question 14: Which HTTP header must be set in an API request to specify that the client expects a JSON response?
- Content-Type: application/json
- Accept: application/json (Correct answer)
- Authorization: Bearer token
- Cache-Control: no-cache
Correct answer: Accept: application/json
The 'Accept: application/json' header tells the server that the client expects a JSON-formatted response.
Question 15: In Selenium test automation, what does the term 'API contract testing' refer to?
- Testing APIs only in production environments
- Ensuring APIs are secured with OAuth tokens
- Testing that API calls return responses within a defined time limit
- Verifying that an API adheres to its documented interface specification (Correct answer)
Correct answer: Verifying that an API adheres to its documented interface specification
API contract testing verifies that an API conforms to its defined specification, ensuring both provider and consumer agree on the interface.
Question 16: Which data management principle is critical in Selenium Testing Certification?
- Keeping all data indefinitely
- Ensuring data integrity, security, and accessibility (Correct answer)
- Only collecting minimal data
- Storing data without organization
Correct answer: Ensuring data integrity, security, and accessibility
Effective data management requires maintaining data integrity, protecting it from unauthorized access, and ensuring it is accessible when needed.
Question 17: What is the primary purpose of Selenium WebDriver's remote execution capability when connecting to a Selenium Grid?
- To debug WebDriver commands in real time
- To enable test execution on remote machines with different browser/OS combinations (Correct answer)
- To generate detailed HTML test reports automatically
- To run tests faster on a local machine
Correct answer: To enable test execution on remote machines with different browser/OS combinations
RemoteWebDriver connects to a Grid Hub/Router to execute tests on remote nodes offering diverse browser and OS configurations.
Question 18: Which framework helps manage and execute Selenium test scripts?
- JUnit
- TestNG (Correct answer)
- Jasmine
- Mocha
Correct answer: TestNG
TestNG is a powerful testing framework for Java that is widely used with Selenium for managing and executing test scripts. It provides advanced features like test configuration, parallel test execution, data-driven testing, and flexible reporting. TestNG simplifies the organization and execution of complex test suites, making it a preferred choice for robust and scalable Selenium automation projects.
Question 19: What is the primary goal of debugging in Selenium testing?
- To identify and fix script errors (Correct answer)
- To introduce new errors
- To reduce test accuracy
- To avoid reviewing test failures
Correct answer: To identify and fix script errors
Debugging in Selenium testing is the systematic process of finding and resolving errors or bugs within the test scripts themselves. The primary goal is to identify why a script is failing or behaving unexpectedly, whether due to incorrect locators, synchronization issues, or logical flaws. By pinpointing and fixing these script errors, testers ensure the reliability and accuracy of their automated tests.
Question 20: In a CI/CD pipeline, where do Selenium tests typically fit?
- In the infrastructure provisioning stage
- Only in the production deployment stage
- Only run manually before release
- As part of the automated test stage triggered after each code commit or build (Correct answer)
Correct answer: As part of the automated test stage triggered after each code commit or build
Selenium tests are integrated into CI/CD pipelines to automatically validate application behavior after every code commit, enabling rapid feedback.
Question 21: Which architectural approach allows a Selenium framework to switch between different browsers without changing test code?
- Hardcoding browser instantiation in every test class
- Using a Driver Factory that reads browser type from a configuration file or system property (Correct answer)
- Storing WebDriver instances in a static global variable
- Creating separate test suites for each browser
Correct answer: Using a Driver Factory that reads browser type from a configuration file or system property
A Driver Factory pattern reads a browser parameter at runtime and returns the appropriate WebDriver, making tests browser-agnostic.
Question 22: What is the role of test execution in automated testing?
- To avoid error identification
- To validate application behavior and detect defects (Correct answer)
- To prevent test scripts from running
- To increase test failures
Correct answer: To validate application behavior and detect defects
In automated testing, test execution is the process of running the pre-written test scripts against the application under test. Its primary role is to systematically validate that the application's behavior conforms to its requirements and specifications. During execution, the automated tests interact with the application and report any deviations or failures, thereby detecting defects early in the development cycle.
Question 23: In a Selenium architecture using the Fluent Page Object pattern, what distinguishes it from the standard Page Object Model?
- Page methods return the current or next page object, enabling method chaining (Correct answer)
- It eliminates the need for WebDriver entirely
- Each page object stores test data alongside UI interactions
- It uses static methods instead of instance methods
Correct answer: Page methods return the current or next page object, enabling method chaining
The Fluent POM pattern has page methods return page object instances, enabling readable method chains like loginPage.enterUser().enterPass().clickLogin().
Question 24: When running parallel tests with TestNG and Selenium Grid, what attribute in testng.xml enables parallel execution at the method level?
- parallel="tests"
- parallel="classes"
- parallel="instances"
- parallel="methods" (Correct answer)
Correct answer: parallel="methods"
Setting parallel="methods" in the suite tag causes each test method to run in a separate thread concurrently.
Question 25: In a hybrid Selenium framework, what does 'hybrid' specifically refer to?
- Using both Selenium WebDriver and Selenium IDE together
- Running tests on both mobile and desktop browsers simultaneously
- Combining Java and Python in the same test suite
- Merging data-driven and keyword-driven approaches in a single framework (Correct answer)
Correct answer: Merging data-driven and keyword-driven approaches in a single framework
A hybrid framework combines data-driven testing (external data sources) with keyword-driven testing (action keywords) for maximum reusability and flexibility.
Question 26: How do you capture a screenshot in Selenium WebDriver and save it to a file?
- driver.takeSnapshot(path)
- ScreenCapture.take(driver, path)
- driver.screenshot().save(path)
- File src = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE) (Correct answer)
Correct answer: File src = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE)
Cast the driver to TakesScreenshot and call getScreenshotAs(OutputType.FILE) to get the screenshot as a File object.
Question 27: In a CI/CD pipeline, what is the primary purpose of running Selenium tests in 'headless' mode?
- To enable parallel test execution
- To bypass browser security restrictions
- To speed up test execution on local machines
- To run tests on servers without a display environment (Correct answer)
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 28: What does the Selenium Grid hub do in a distributed test execution setup?
- Receives test requests and routes them to registered nodes (Correct answer)
- Stores test results in a database
- Runs test scripts directly on browsers
- Generates test reports automatically
Correct answer: Receives test requests and routes them to registered nodes
The hub acts as a central router that receives test session requests and delegates them to available nodes.
Question 29: What is a stakeholder analysis in Selenium Testing Certification planning?
- Identifying and assessing the interests and influence of affected parties (Correct answer)
- A competitive market review
- A financial audit
- A staff satisfaction survey
Correct answer: Identifying and assessing the interests and influence of affected parties
Stakeholder analysis identifies all parties affected by or having influence over a project, helping manage expectations and engagement.
Question 30: In a Selenium Grid 4 fully distributed architecture, which component can be scaled independently to increase session throughput?
- The Session Map, since it is the performance bottleneck
- The Event Bus, since all components communicate through it
- The Node, since more nodes directly increase available browser slots (Correct answer)
- The Router, since it handles all incoming HTTP requests
Correct answer: The Node, since more nodes directly increase available browser slots
Scaling Nodes horizontally increases the total number of concurrent browser sessions the Grid can handle, directly improving test throughput.
Certified Professional Selenium Tester (CPST)
The CPST certification validates expertise in Selenium automation testing including WebDriver, test design, scripting, grid configuration, API integration, and cloud-based testing solutions. It is designed for QA engineers and automation testers.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds