GAQM CPST Practice Questions with Explanations

Free GAQM CPST practice questions. 18 of them, each with the correct answer, a full explanation, and the reason every other option is wrong.

CPST practice questions

Question 1

Which of the following languages is supported by The Selenium Web Driver?

  • A. Cobol
  • B. PHP
  • C. Perl
  • D. C++
Show answer and explanation ▾

Correct answer: B

WebDriver tests can be written in PHP: PHP client bindings send commands to the browser driver over the standard WebDriver protocol, in the same way as the Java, C#, Python and Ruby bindings.

Why the other options are wrong:

  • A. Cobol has no Selenium WebDriver client bindings.
  • C. Perl is not one of the languages the Selenium project provides client bindings for.
  • D. C++ is not one of the languages the Selenium project provides client bindings for.

Question 2

sendKeys-Sends keys to the keyboard representation in the browser.

  • A. True
  • B. False
Show answer and explanation ▾

Correct answer: A

sendKeys types the given text or key presses into the element in the browser, as if typed on a keyboard, so the statement is true.

Why the other options are wrong:

  • B. The statement matches how sendKeys works: it sends keystrokes to the browser.

Question 3

What are the types of exceptions thrown in web driver? (Choose three.)

  • A. NoSuchElementException
  • B. NoElementFoundException
  • C. StateElementReferenceException
  • D. ElementNotSelectableException
Show answer and explanation ▾

Correct answer: A, C, D

NoSuchElementException, StaleElementReferenceException and ElementNotSelectableException are all exception classes in Selenium WebDriver.

Why the other options are wrong:

  • B. NoElementFoundException is not a Selenium exception; the exception for a missing element is NoSuchElementException.

Question 4

Which of the following step is not involved in creating Selenium tests using IDE?

  • A. Recording and adding commands in a test
  • B. Saving the recorded test
  • C. Saving the test suite
  • D. Executing the recorded test
  • E. Installing Static and Dynamic Functions
Show answer and explanation ▾

Correct answer: E

Creating a test in Selenium IDE means recording commands, saving the test, saving the suite and running it. Installing static and dynamic functions is not part of that flow.

Why the other options are wrong:

  • A. Recording and adding commands is the first step of building an IDE test.
  • B. Saving the recorded test is a normal step in IDE.
  • C. Saving the test suite is a normal step in IDE.
  • D. Executing the recorded test is how you check it in IDE.

Question 5

Which command can be used to ensure that the script and application are in sync?

  • A. waitForAlertPresent
  • B. waitForParsePresent
  • C. waitForCurrentPresent
Show answer and explanation ▾

Correct answer: A

waitFor commands pause the script until a condition is met, and waitForAlertPresent waits for an alert to appear, which keeps the script in step with the application.

Why the other options are wrong:

  • B. waitForParsePresent is not a Selenium command.
  • C. waitForCurrentPresent is not a Selenium command.

Question 6

What is the primary advantage of using Selenium WebDriver for web application testing?

  • A. It only supports testing in a single browser and operating system.
  • B. It can replicate user interactions such as clicking links and filling out forms, and does not get bored like humans.
  • C. It eliminates the need for creating test automation.
  • D. It requires no programming knowledge to use.
Show answer and explanation ▾

Correct answer: B

Selenium WebDriver drives a real browser the way a user does, clicking links and filling out forms. Because the steps are automated, they can be repeated as often as needed with the same accuracy every time.

Why the other options are wrong:

  • A. WebDriver works with many browsers and operating systems, not just one.
  • C. WebDriver is a tool for building test automation and does not remove the need to create it.
  • D. WebDriver tests are written in a programming language, so programming knowledge is needed.

Question 7

Which of the following is a primary use of the Selenium WebDriver API in relation to cookies?

  • A. To monitor website traffic
  • B. To store images on the client-side
  • C. To manage cookies by reading, adding, or deleting them during tests
  • D. To simulate user actions in forms
Show answer and explanation ▾

Correct answer: C

The WebDriver API lets a test work with the browser's cookies directly: it can read all cookies or a named one, add a new cookie, and delete one or all of them during a test.

Why the other options are wrong:

  • A. Monitoring website traffic is not what the WebDriver cookie methods are for.
  • B. Cookies hold small pieces of text data, and WebDriver does not use them to store pictures.
  • D. Simulating user actions in forms is done with element methods, not with the cookie methods.

Question 8

Which tool in the Selenium suite allows testers to record their actions as they follow the workflow they need to test?

  • A. Selenium WebDriver
  • B. Selenium Grid
  • C. Selenium RC
  • D. Selenium IDE
Show answer and explanation ▾

Correct answer: D

Selenium IDE is a browser extension with record and playback. It captures the tester's clicks and typing as they walk through the workflow and saves them as a test that can be replayed.

Why the other options are wrong:

  • A. Selenium WebDriver runs tests written in code and has no recorder.
  • B. Selenium Grid distributes test runs across machines and does not record actions.
  • C. Selenium RC runs scripted tests through a server and is not the recording tool.

Question 9

Which of the following components is not the part of Selenium suite?

  • A. Selenium Grid
  • B. Selenium IDE
  • C. Selenium RC
  • D. Selenium Web
Show answer and explanation ▾

Correct answer: D

The Selenium suite consists of Selenium IDE, Selenium RC, Selenium WebDriver and Selenium Grid. There is no component called Selenium Web.

Why the other options are wrong:

  • A. Selenium Grid is part of the suite and runs tests on multiple machines.
  • B. Selenium IDE is part of the suite and provides record and playback.
  • C. Selenium RC is part of the suite, the original remote control tool.

Question 10

Which Parameter provides information about the display screen such as size and resolution?

  • A. GraphicsConfiguration
  • B. CardConfiguration
  • C. DriverConfiguration
  • D. WebConfiguration
Show answer and explanation ▾

Correct answer: A

GraphicsConfiguration is the Java class that describes the characteristics of a graphics destination such as a monitor, including the bounds of the display screen.

Why the other options are wrong:

  • B. CardConfiguration is not the parameter that describes the display screen.
  • C. DriverConfiguration is not the parameter that describes the display screen.
  • D. WebConfiguration is not the parameter that describes the display screen.

Question 11

Globbing in Selenium supports only three special characters: * , ?, and [].

  • A. True
  • B. False
Show answer and explanation ▾

Correct answer: B

Selenium globbing patterns support only two special characters: the asterisk, which matches any run of characters, and square brackets, which match any single character in the class. The question mark used by other globbing dialects is not supported, so the statement is false.

Why the other options are wrong:

  • A. Selenium globbing does not support the question mark, so it has two special characters, not three.

Question 12

Which Mouse Action Performs a context click/right-click on an element on based on the coordinates?

  • A. contextClick
  • B. doubleClick
  • C. mouseDown
  • D. mouseUp
Show answer and explanation ▾

Correct answer: A

The contextClick action of the Actions class performs a right-click, which opens the context menu, either on a given element or at the current mouse position.

Why the other options are wrong:

  • B. doubleClick performs two quick left clicks, not a right-click.
  • C. mouseDown only presses the mouse button and does not perform a context click.
  • D. mouseUp only releases the mouse button and does not perform a context click.

Question 13

Selenium scripts can run tests only against FireFox as the tool IDE itself is a plugin of Firefox.

  • A. True
  • B. False
Show answer and explanation ▾

Correct answer: B

Selenium scripts are not limited to Firefox. Tests created in Selenium IDE can be run against other browsers such as Chrome, Edge and Safari through Selenium WebDriver or Selenium RC.

Why the other options are wrong:

  • A. Selenium tests run against many browsers, so the statement is not true.

Question 14

Which of the following executes the Selenium command using its JavaScript interpreter?

  • A. Complier
  • B. Repeater
  • C. Booster
  • D. Browser
Show answer and explanation ▾

Correct answer: D

Selenium Core is a JavaScript program loaded into the browser under test. The browser's own JavaScript interpreter runs it and so executes each Selenium command against the page.

Why the other options are wrong:

  • A. A compiler translates source code and does not execute Selenium commands in the page.
  • B. A repeater is not a component that executes Selenium commands.
  • C. A booster is not a component that executes Selenium commands.

Question 15

Which tool in the Selenium suite is used to run parallel tests across different machines and browsers?

  • A. Selenium IDE
  • B. Selenium RC
  • C. Selenium Grid
Show answer and explanation ▾

Correct answer: C

Selenium Grid uses a hub that sends tests to registered nodes. The nodes can be different machines with different browsers and operating systems, so many tests run in parallel.

Why the other options are wrong:

  • A. Selenium IDE records and plays back tests in one browser and does not distribute them.
  • B. Selenium RC runs tests through a single server and does not distribute them across machines by itself.

Question 16

Which control executes the entire test suite that contains multiple test cases?

  • A. Run All
  • B. Speed Control
  • C. Step
  • D. Pulse
Show answer and explanation ▾

Correct answer: A

The Run All control in Selenium IDE executes every test case in the loaded test suite, one after another. The separate Run control executes only the selected test case.

Why the other options are wrong:

  • B. Speed Control only changes how fast the commands are executed.
  • C. Step executes one command at a time for debugging, not the whole suite.
  • D. Pulse is not a Selenium IDE control for running tests.

Question 17

Which method in the

Select class is used to check if a dropdown or list element supports multi-selection?

  • A. getOptions()
  • B. isMultiple()
  • C. getSelectedOptions ()
  • D. isSelectable()
Show answer and explanation ▾

Correct answer: B

The isMultiple() method of the Select class returns true when the select element allows more than one option to be chosen at the same time, and false when it is a single-choice dropdown.

Why the other options are wrong:

  • A. getOptions() returns all options in the list and does not report whether multi-selection is allowed.
  • C. getSelectedOptions() returns the options currently selected and does not report whether multi-selection is allowed.
  • D. isSelectable() is not a method of the Select class.

Question 18

Which one is not the correct type of locater?

  • A. XSD
  • B. Name
  • C. CSS
  • D. ID
Show answer and explanation ▾

Correct answer: A

Selenium locates elements by ID, name, class name, tag name, link text, partial link text, CSS selector and XPath. XSD is an XML schema language and is not a locator.

Why the other options are wrong:

  • B. Name is a valid locator that matches the name attribute of an element.
  • C. CSS is a valid locator that uses CSS selector syntax.
  • D. ID is a valid locator that matches the id attribute of an element.

That was 18 of 50.

The full GAQM CPST pack has all 50 questions, each with the answer, the explanation and why the other options are wrong, plus a questions-only copy for timed runs. $39.00 USD, paid once, with free monthly updates and a pass-or-your-money-back guarantee.

Get the full pack

Not ready yet? Get the first 19 free as one PDF by email. Get the Half Pack →

About the CPST exam

These 18 GAQM CPST questions are free here. The free PDF has 19, free by email.

They are drawn from the same bank as the full CPST pack, which has 50 questions in total.

Back to blog