Frameworks, locators, waits, flakiness, page objects
Practise these as flashcards. One or two lines each; the ones you miss come back first.
Start freePlaywright supports modern browser features and auto-waiting, Selenium is mature and language-agnostic, and Cypress is fast but mainly for Chrome-family browsers and JavaScript. Playwright and Cypress offer easier parallelization, while Selenium is more flexible with languages and browsers.
nth-child or dynamic class names in selectors?Selectors like nth-child or dynamic classes are fragile because UI changes or updates can break them. Using stable attributes like IDs or accessible roles makes tests more reliable.
Auto-waiting means Playwright automatically waits for elements to be ready before interacting, reducing the need for manual waits and making tests less flaky.
The Page Object Model is a design pattern where each page or component is represented by a class or module, encapsulating elements and actions. This makes tests easier to maintain and reuse.
I review the test logs to identify where timing issues occur, then add explicit waits or use auto-waiting features to ensure elements are ready. I also check for unstable selectors and improve them if needed.
Playwright automatically waits for elements to be actionable, reducing manual waits. Selenium requires explicit waits, like WebDriverWait, for conditions such as visibility or clickability, making it more prone to flakiness if not handled carefully.
POM improves code organization, reusability, and maintainability. It separates test logic from page structure, so changes to the UI only require updates in one place, not across all tests.
I use stable selectors like IDs, accessible roles, and data attributes. I avoid fragile selectors and regularly review them when the UI changes, updating page objects as needed.
I use unique test data for each parallel run, either by generating random values or using isolated fixtures. This prevents conflicts and ensures tests don't interfere with each other.
I configure the CI tool, like GitHub Actions or Jenkins, to install dependencies and run tests on every code push. I set up reporting and notifications for failures to ensure fast feedback.
Visual testing compares screenshots of the UI against baselines to catch layout or style regressions. I use tools like Playwright's toHaveScreenshot or integrate Percy for automated visual checks.
I'd configure Playwright's projects to target multiple browsers like Chromium, Firefox, and WebKit. Tests would run in parallel across these browsers, and I'd monitor for browser-specific failures, updating selectors or handling quirks as needed.