← All Playwright Python mock interview topics
Test your knowledge of Locators and Interactions with a timed Playwright Python MCQ mock test. Each attempt gives you 20 random questions in 20 minutes from a 200-question bank covering locators (get_by_role, get_by_label, get_by_text, get_by_test_id), strictness, filtering and chaining, CSS and XPath selectors, actions and actionability, keyboard and mouse, dropdowns and dates, dialogs, iframes, popups and tabs, web tables, and file upload and download. Submit to see your score, the correct answers and an explanation for every question.
What this mock test covers
The questions follow Module 4 of the free Playwright with Python & Pytest tutorial. Revise these lessons if a question catches you out:
- Playwright Python Locators: get_by_role and Friends
- CSS and XPath Selectors in Playwright Python
- Actions: click, fill, press, check, select_option and hover
- Dialogs, iFrames, Popups and New Tabs
- Read Data from Web Tables
- File Upload and File Download
Sample questions with answers
- Q. What is a Playwright locator?
Answer: A description of how to find elements, resolved each time it is used
Locators are lazy and re-evaluated on every action or assertion. - Q. When does page.get_by_role('button', name='Submit') search the page?
Answer: When you act on it or assert with it, not when it is created
Creating a locator does not search the page. - Q. Why do Playwright locators avoid 'stale element' errors?
Answer: They are re-evaluated on every use, so re-rendered elements are found again
There is no stored element reference to go stale. - Q. Which locator does Playwright recommend trying first?
Answer: get_by_role with an accessible name
Role-based locators reflect how users and assistive technology see the page. - Q. Which locator is best for a form input with a proper <label>?
Answer: get_by_label
get_by_label finds the control the label points to.
Ready for more? Go back to the Playwright Python mock interview dashboard to track your overall interview readiness.
Frequently asked questions
How many questions does the Locators and Interactions mock test have?
The question bank has 200 questions. Each test picks 20 at random, favouring questions you have not seen, so about 10 attempts cover the full bank.
What is the pass mark?
You pass a test with 70% or more, which is 14 of 20 questions correct.
Can I retake the test?
Yes. Retake as often as you like. Every retake draws a fresh set of 20 questions and counts toward your 20-exam readiness target.