readyforhires

Advanced Selenium test (Advanced)

40 questions · 40 minutes · Free

Selenium Grid, parallel runs, flaky-test control and CI frameworks.

Take the Advanced Selenium test

What it covers

Interview format

Earn a certificate

The Advanced Selenium test is one of the 8 tests of the QA Automation Engineer: Advanced learning path. Pass it and the other 7 tests at 70% or more and readyforhires issues you a verifiable certificate in your name, with its own code and verify link to share or add to LinkedIn.

Sample learning path certificate for QA Automation Engineer: Advanced, made out to “Your name” and marked SAMPLE
Pass with 70% or more to earn a verifiable certificate. This is a sample: yours carries your name, the date you earned it and its own verify code.

Sample questions

5 sample questions from the Advanced Selenium test, with the answers. Samples are taken out of the live test, so you will not meet these when you sit it.

  1. In a CI pipeline, how can you effectively control the concurrency of test execution while ensuring optimal resource utilization and avoiding overloading the system?

    1. Use a distributed Selenium Grid with a hub and multiple nodes, and configure the test runner to use a fixed thread count with parallelism set to 'tests'.
    2. Use a single Selenium Grid node and increase the `--max-sessions` parameter to allow more concurrent tests.
    3. Allow the test runner to dynamically scale the number of threads based on available system resources.
    4. Run all tests sequentially on a single node to avoid overloading the CI pipeline.

    Answer: A. Use a distributed Selenium Grid with a hub and multiple nodes, and configure the test runner to use a fixed thread count with parallelism set to 'tests'.

    In a CI pipeline, using a distributed Selenium Grid with a hub and multiple nodes ensures that tests are distributed across available resources. Configuring the test runner with a fixed thread count and parallelism set to 'tests' ensures that tests are executed in parallel without overwhelming the system, allowing for better concurrency control and resource utilization.

  2. What is the result of executing the command `java -jar selenium-server-<ver>.jar standalone` to start a Selenium Grid container?

    1. The Selenium Grid container will not start and will throw an error due to missing command-line arguments.
    2. The Selenium Grid container will start in distributed mode and require additional nodes to be configured.
    3. The Selenium Grid container will start in hub mode and require separate node configurations to be added manually.
    4. The Selenium Grid container will start in standalone mode, listening on port 4444, and will be accessible via the default UI at http://localhost:4444/ui.

    Answer: D. The Selenium Grid container will start in standalone mode, listening on port 4444, and will be accessible via the default UI at http://localhost:4444/ui.

    The command `java -jar selenium-server-<ver>.jar standalone` starts the Selenium Grid in standalone mode, which is the default configuration. It listens on port 4444 and provides a UI at `/ui` for managing the Grid. The other options describe incorrect behaviors or unrelated configurations.

  3. In a realistic project scenario, how should you apply Selenium Grid hub authentication to secure access to the hub?

    1. Allow unauthenticated access to the Grid hub and rely on network-level security for protection.
    2. Leverage IP whitelisting on the Grid hub to restrict access without explicit authentication.
    3. Use a static token stored in a configuration file for authentication on the Grid hub.
    4. Use a username and password with the Selenium Grid hub's authentication feature, and configure the RemoteWebDriver to include these credentials in the URL.

    Answer: D. Use a username and password with the Selenium Grid hub's authentication feature, and configure the RemoteWebDriver to include these credentials in the URL.

    Selenium Grid hub authentication can be applied by including credentials in the RemoteWebDriver URL as `http://username:password@grid-hub:4444`. This ensures secure access to the hub. Other options are incorrect because they either use outdated methods or misconfigure the authentication mechanism.

  4. Which exception is commonly encountered in Selenium tests when an element is no longer present in the DOM after a page change, leading to flakiness?

    1. NoSuchElementException
    2. ElementNotInteractableException
    3. StaleElementReferenceException
    4. TimeoutException

    Answer: C. StaleElementReferenceException

    A StaleElementReferenceException occurs when a previously located element is no longer present in the DOM, often due to a page refresh or navigation. This is a common cause of flakiness in Selenium tests and can be mitigated by re-locating the element after page changes, rather than caching it.

  5. What is the correct approach to avoid issues with WebDriver instances during parallel test execution in Selenium?

    1. Use implicit waits with a high timeout to handle all synchronization needs.
    2. Use one WebDriver instance per thread, typically stored in a ThreadLocal<WebDriver> and quit in teardown.
    3. Allow tests to depend on the execution order of other tests to avoid conflicts.
    4. Use a static shared WebDriver instance across all threads for consistency.

    Answer: B. Use one WebDriver instance per thread, typically stored in a ThreadLocal<WebDriver> and quit in teardown.

    In parallel test execution, WebDriver instances are not thread-safe. Using one WebDriver instance per thread ensures that each test runs independently without interference. Storing the driver in a ThreadLocal<WebDriver> guarantees that each thread has its own instance, and quitting the driver in teardown ensures proper cleanup and resource management.

Frequently asked questions

How many questions are in the Advanced Selenium test?
40 questions (24 multiple choice, 12 multi-answer, 4 predict-the-output), with 40 minutes to answer them.
What does the Advanced Selenium test cover?
Selenium Grid and parallel runs, Flaky Selenium test control, Selenium in CI pipelines, Hybrid Selenium frameworks, Selenium 4 features.
Is the Advanced Selenium test free?
Yes. It is free to take with a readyforhires account.
What level is the Advanced Selenium test?
Advanced, in Testing & QA.

More Testing & QA tests

All practice tests · All Testing & QA tests

Last updated