---
title: Selenium C# Quiz | Selenium C# Tutorial with NUnit
description: Ten questions on the decisions this course made and why. Each answer
  explains the reasoning once you check. The quiz is a self-check; nothing is recorded.
  1.…
source_url:
  html: https://testingbot.com/resources/courses/selenium-csharp/knowledge-check
  md: https://testingbot.com/resources/courses/selenium-csharp/knowledge-check.md
---

Course

[Selenium C# Tutorial with NUnit](https://testingbot.com/resources/courses/selenium-csharp)

Chapter 10 of 10

1. [1 Selenium C# Tutorial with NUnit](https://testingbot.com/resources/courses/selenium-csharp)
2. [2 Set up .NET, Selenium and NUnit](https://testingbot.com/resources/courses/selenium-csharp/setup-and-first-test)
3. [3 Selenium C# locators and WebDriverWait](https://testingbot.com/resources/courses/selenium-csharp/locators-and-waits)
4. [4 NUnit fixtures, attributes and [TestCase] ](https://testingbot.com/resources/courses/selenium-csharp/nunit-fixtures-and-attributes)
5. [5 NUnit assertions and screenshots on failure](https://testingbot.com/resources/courses/selenium-csharp/assertions-and-screenshots)
6. [6 Page objects in C#](https://testingbot.com/resources/courses/selenium-csharp/page-objects)
7. [7 Run Selenium C# tests on the TestingBot grid](https://testingbot.com/resources/courses/selenium-csharp/run-on-testingbot)
8. [8 Parallel Selenium tests with NUnit](https://testingbot.com/resources/courses/selenium-csharp/parallel-tests)
9. [9 Selenium C# tests in CI](https://testingbot.com/resources/courses/selenium-csharp/ci-with-github-actions)
10. [10 Selenium C# Quiz](https://testingbot.com/resources/courses/selenium-csharp/knowledge-check)

[Exit course](https://testingbot.com/resources/courses)

 Chapter 10 of 10 Intermediate 6 min read Updated Nov 2026 

# Selenium C# Quiz

Ten questions on the decisions this course made and why. Each answer explains the reasoning once you check. The quiz is a self-check; nothing is recorded.

1. A new project has `Selenium.WebDriver`, `NUnit` and the `Selenium.WebDriver.ChromeDriver` package. What should you change before the first commit?

 Nothing; the driver package is required for Chrome. Remove the driver package and add `NUnit3TestAdapter` and `Microsoft.NET.Test.Sdk`. Replace NUnit with MSTest, which needs no adapter.

Selenium Manager inside `Selenium.WebDriver` resolves the right driver at run time, so a pinned driver package only causes version mismatches. Without the adapter and test SDK, `dotnet test` discovers no tests at all. MSTest needs its own adapter too.

2. The build fails with NUnit1032, "The field driver should be Disposed in a method annotated with [TearDownAttribute]", although TearDown calls `driver.Quit()`. What is the cleanest fix?

 Suppress all NUnit analyzer warnings in the project file. Call both `Quit()` and `Dispose()`. Tell the analyzer that `Quit` disposes, with `dotnet_diagnostic.NUnit1032.additional_dispose_methods = Quit` in `.editorconfig`.

`Quit()` closes the browser and disposes the driver; the analyzer just does not know that. The setting teaches it once. Removing the analyzers loses checks that catch real bugs, and calling both works but adds noise to every teardown.

3. Which wait returns the element only once it can be typed into?

 `wait.Until(d => { var e = d.FindElement(by); return e.Displayed && e.Enabled ? e : null; })` `wait.Until(d => d.FindElement(by))` `wait.Until(ExpectedConditions.ElementToBeClickable(by))`

`Until` keeps polling while the lambda returns null, so returning the element only when it is displayed and enabled waits for exactly that. Option b only waits for presence; option c does not compile in Selenium 4, which has no `ExpectedConditions`.

4. A test passes when run headed and fails headless with `ElementClickInterceptedException` on a button near the bottom of the page. What do you check first?

 Whether headless Chrome supports clicks. The window size: headless Chrome starts small, so the layout differs and another element covers the button. Whether the button's locator is unique.

"Click intercepted" means the element was found but something else is on top of it at that point. A smaller viewport changes the layout; giving headless Chrome a desktop window size fixed exactly this in chapter 3. A wrong locator would give a different error.

5. You want one login test to run for a list of accounts built at run time from a CSV file, each account reported separately. What do you use?

 A `[TestCase]` per CSV line, generated by hand. A `foreach` loop inside one `[Test]`. `[TestCaseSource]` pointing at a static method that reads the CSV.

`[TestCase]` takes only constants, and hand-copying data means it drifts from the file. A loop produces one result and stops at the first failure. `[TestCaseSource]` turns each row into its own named test.

6. Inside `using (Assert.EnterMultipleScope())`, the second of five assertions calls `FindElement` on an element that does not exist. What does the report show?

 Any failure from the first assertion, plus the `NoSuchElementException`; the remaining assertions never run. All five results, with the exception counted as one failed assertion. Only "Multiple failures" with no details.

The scope collects assertion failures, but an unexpected exception still ends the test immediately, reported together with any failures recorded before it. Make sure the page is ready before the block and use the block for details.

7. A page object keeps `private IWebElement submit`, found in its constructor. What is the risk?

 Fields are slower to access than locals. If the page re-renders, the stored element is stale and every later use throws `StaleElementReferenceException`. Page objects may not have private fields.

An element reference points at one DOM node. Keeping a `By` locator and finding the element when an action runs always gets the current node.

8. A grid test fails in NUnit, but the TestingBot dashboard shows it with no result. Which TearDown order is correct?

 `Quit()`, then `ExecuteScript("tb:test-result=failed")`. Nothing in TearDown; the grid reads NUnit's result file. Read the outcome from `TestContext`, send `tb:test-result` while the session is open, then `Quit()` in a `finally`.

The `tb:` command travels over the open WebDriver session, so it must run before `Quit()`. The grid has no access to NUnit's results. After quitting, only the REST API can still set the status.

9. With `[assembly: Parallelizable(ParallelScope.All)]`, tests in the same class fail at random with `ObjectDisposedException`. What does the course add?

 `[assembly: FixtureLifeCycle(LifeCycle.InstancePerTestCase)]`, so every test gets its own fixture instance and `Driver`. A `static` driver shared by all tests. `lock` statements around every Selenium call.

By default all tests in a fixture share one instance, so parallel tests overwrite and quit each other's driver. One instance per test removes the sharing. A static driver makes it worse, and locks would serialise the tests again.

10. A pull request puts the TestingBot key and secret in a committed `.runsettings` file "so CI works". What should you ask for instead?

 Base64-encode the values in the file. Read `TB_KEY` and `TB_SECRET` from environment variables filled from CI secrets, and rotate the leaked pair. Move them into `appsettings.json`.

Anything committed, in any file or encoding, is readable by everyone with repository access and stays in history. Environment variables from CI secrets keep credentials out of the code, and a pair that was committed should be replaced.

Check answers

## Where to go next[#](https://testingbot.com#where-to-go-next)

- Run the suite on more browser and OS combinations with the [capabilities generator](https://testingbot.com/support/web-automate/selenium/capabilities).
- Grow the page objects into a framework with the [Page Object Model course](https://testingbot.com/resources/courses/page-object-model).
- Write behaviour-driven tests in C# with [Reqnroll](https://testingbot.com/support/web-automate/selenium/csharp/reqnroll), or compare the same suite in [Python](https://testingbot.com/resources/courses/selenium-python) and [Java](https://testingbot.com/resources/courses/selenium-testng).
- Prepare for interviews with the [Selenium interview questions](https://testingbot.com/resources/courses/selenium-interview-questions).

[Previous · Chapter 9 Selenium C# tests in CI](https://testingbot.com/resources/courses/selenium-csharp/ci-with-github-actions)
## You finished Selenium C# Tutorial with NUnit

Put what you learned into practice. Run your tests on 6100+ real browsers and physical iOS and Android devices.

[Start free trial](https://testingbot.com/users/sign_up) [See pricing](https://testingbot.com/pricing) [Browse other courses](https://testingbot.com/resources/courses)

## TestingBot Selenium C# Certification

Turn this course into a free, resume-worthy credential: pass the exam, run the course suite on TestingBot, and get a verifiable certificate for your LinkedIn profile.

[How it works](https://testingbot.com/resources/courses/selenium-csharp/certification)
