Skip to content

Playwright interview questions — Easy

401 easy-level Playwright questions from our Automation Testing bank, each with the correct answer and an explanation of why it is correct.

What this covers

Playwright appears throughout Automation Testing interviews. At easy level, interviewers are typically checking that you know the fundamentals and can describe them precisely — definitions, defaults, and the basic mechanics. Work through these, then explain your answer out loud; the second part is what interviews actually test.

20 example questions

  1. 1. What is the purpose of trace: 'on-first-retry' in Playwright?

    • A. Executes JavaScript in the page's context and returns the result.
    • B. Locates elements containing the given text.
    • C. Groups actions into a named step shown in reports and traces.
    • D. Config option that records a trace only when a test is retried.correct

    Why: trace: 'on-first-retry': Config option that records a trace only when a test is retried.

  2. 2. In the context of Playwright, expect(locator).toBeVisible() is best described as:

    • A. Performs an actionability-checked click on the matched element.
    • B. Locates elements by the data-testid attribute.
    • C. Retrying assertion that the element is visible.correct
    • D. Waits for a network response matching a URL or predicate.

    Why: expect(locator).toBeVisible(): Retrying assertion that the element is visible.

  3. 3. What is the purpose of expect(locator).toBeVisible() in Playwright?

    • A. Retrying assertion that the element is visible.correct
    • B. Locates elements by the data-testid attribute.
    • C. Config option that records a trace only when a test is retried.
    • D. Navigates the page to a URL and waits for the load state.

    Why: expect(locator).toBeVisible(): Retrying assertion that the element is visible.

  4. 4. In Playwright, what does browser.newContext() do or refer to?

    • A. Groups actions into a named step shown in reports and traces.
    • B. Navigates the page to a URL and waits for the load state.
    • C. Creates a fresh isolated browser session.correct
    • D. Config option that records a trace only when a test is retried.

    Why: browser.newContext(): Creates a fresh isolated browser session.

  5. 5. Which of the following best describes browser.newContext() in Playwright?

    • A. Overrides fixtures/options such as viewport or locale for a test group.
    • B. Retrying assertion that the element is visible.
    • C. Creates a fresh isolated browser session.correct
    • D. Locates elements containing the given text.

    Why: browser.newContext(): Creates a fresh isolated browser session.

  6. 6. Which of the following best describes fullyParallel in Playwright?

    • A. Locates elements containing the given text.
    • B. Config flag that runs tests within a single file in parallel.correct
    • C. Creates a fresh isolated browser session.
    • D. Navigates the page to a URL and waits for the load state.

    Why: fullyParallel: Config flag that runs tests within a single file in parallel.

  7. 7. Which of the following best describes npx playwright show-report in Playwright?

    • A. Locates elements containing the given text.
    • B. Retrying assertion that the element is visible.
    • C. Opens the HTML report of the last test run.correct
    • D. Clears and types text into an input field.

    Why: npx playwright show-report: Opens the HTML report of the last test run.

  8. 8. Which of the following best describes projects in Playwright?

    • A. Creates a fresh isolated browser session.
    • B. Config entries that run the suite against multiple browsers or devices.correct
    • C. Navigates the page to a URL and waits for the load state.
    • D. Retrying assertion that the element is visible.

    Why: projects: Config entries that run the suite against multiple browsers or devices.

  9. 9. Which of the following best describes test.use() in Playwright?

    • A. Config flag that runs tests within a single file in parallel.
    • B. Opens the HTML report of the last test run.
    • C. Overrides fixtures/options such as viewport or locale for a test group.correct
    • D. Executes JavaScript in the page's context and returns the result.

    Why: test.use(): Overrides fixtures/options such as viewport or locale for a test group.

  10. 10. Which of the following best describes page.screenshot() in Playwright?

    • A. Locates elements containing the given text.
    • B. Opens the HTML report of the last test run.
    • C. Locates elements by the data-testid attribute.
    • D. Captures a screenshot of the page or viewport.correct

    Why: page.screenshot(): Captures a screenshot of the page or viewport.

  11. 11. In a QA certification mock exam: Which Playwright tool replays a run with DOM snapshots and network for debugging?

    • A. Selenium IDE.
    • B. Trace Viewer.correct
    • C. JMeter Listener.
    • D. Appium Inspector.

    Why: Trace Viewer replays runs with snapshots, network, and console.

  12. 12. Which of the following best describes getByTestId() in Playwright?

    • A. Overrides fixtures/options such as viewport or locale for a test group.
    • B. Config entries that run the suite against multiple browsers or devices.
    • C. Locates elements by the data-testid attribute.correct
    • D. Opens the HTML report of the last test run.

    Why: getByTestId(): Locates elements by the data-testid attribute.

  13. 13. What is the purpose of npx playwright show-report in Playwright?

    • A. Opens the HTML report of the last test run.correct
    • B. Captures a screenshot of the page or viewport.
    • C. Navigates the page to a URL and waits for the load state.
    • D. Clears and types text into an input field.

    Why: npx playwright show-report: Opens the HTML report of the last test run.

  14. 14. Which of the following best describes trace: 'on-first-retry' in Playwright?

    • A. Locates elements by the data-testid attribute.
    • B. Config flag that runs tests within a single file in parallel.
    • C. Opens the HTML report of the last test run.
    • D. Config option that records a trace only when a test is retried.correct

    Why: trace: 'on-first-retry': Config option that records a trace only when a test is retried.

  15. 15. Which of the following best describes expect(locator).toBeVisible() in Playwright?

    • A. Retrying assertion that the element is visible.correct
    • B. Overrides fixtures/options such as viewport or locale for a test group.
    • C. Config entries that run the suite against multiple browsers or devices.
    • D. Locates elements by the data-testid attribute.

    Why: expect(locator).toBeVisible(): Retrying assertion that the element is visible.

  16. 16. In the context of Playwright, trace: 'on-first-retry' is best described as:

    • A. Config option that records a trace only when a test is retried.correct
    • B. Locates elements containing the given text.
    • C. Performs an actionability-checked click on the matched element.
    • D. Creates a fresh isolated browser session.

    Why: trace: 'on-first-retry': Config option that records a trace only when a test is retried.

  17. 17. Which of the following best describes page.waitForResponse() in Playwright?

    • A. Config option that records a trace only when a test is retried.
    • B. Navigates the page to a URL and waits for the load state.
    • C. Clears and types text into an input field.
    • D. Waits for a network response matching a URL or predicate.correct

    Why: page.waitForResponse(): Waits for a network response matching a URL or predicate.

  18. 18. Which of the following best describes locator.click() in Playwright?

    • A. Executes JavaScript in the page's context and returns the result.
    • B. Performs an actionability-checked click on the matched element.correct
    • C. Overrides fixtures/options such as viewport or locale for a test group.
    • D. Locates elements containing the given text.

    Why: locator.click(): Performs an actionability-checked click on the matched element.

  19. 19. In Playwright, what does expect(locator).toBeVisible() do or refer to?

    • A. Performs an actionability-checked click on the matched element.
    • B. Captures a screenshot of the page or viewport.
    • C. Retrying assertion that the element is visible.correct
    • D. Clears and types text into an input field.

    Why: expect(locator).toBeVisible(): Retrying assertion that the element is visible.

  20. 20. What is the purpose of projects in Playwright?

    • A. Opens the HTML report of the last test run.
    • B. Retrying assertion that the element is visible.
    • C. Config entries that run the suite against multiple browsers or devices.correct
    • D. Creates a fresh isolated browser session.

    Why: projects: Config entries that run the suite against multiple browsers or devices.

Related Automation Testing topics