Recall & Review
beginner
What is a 'fragile test' in Selenium?
A fragile test is one that breaks easily due to small changes in the web page, like changes in element locators or page layout.
Click to reveal answer
beginner
Why is mastering selectors important for test stability?
Mastering selectors helps create robust locators that don't break when the page changes, making tests more reliable and easier to maintain.
Click to reveal answer
intermediate
Name two locator strategies that help reduce test fragility.
Using unique IDs and stable CSS classes or attributes helps reduce fragility by targeting elements less likely to change.
Click to reveal answer
intermediate
How does using XPath with absolute paths affect test fragility?
Absolute XPath paths are fragile because they depend on the full element hierarchy, which can change often, causing tests to fail.
Click to reveal answer
beginner
What is a best practice to avoid fragile tests when selecting elements?
Use relative locators, unique attributes, and avoid relying on element order or text that might change frequently.
Click to reveal answer
Which locator strategy is generally the most stable for Selenium tests?
✗ Incorrect
Unique element IDs rarely change and provide a direct way to locate elements, making tests more stable.
What happens if you use fragile selectors in your tests?
✗ Incorrect
Fragile selectors cause tests to fail frequently because small UI changes break the locator.
Which of these is NOT a good practice to prevent fragile tests?
✗ Incorrect
Relying on element order is fragile because the order can change easily.
Why should you avoid using text content as the only locator?
✗ Incorrect
Text content can change due to UI updates or translations, making tests fragile.
What is a benefit of mastering selectors in Selenium?
✗ Incorrect
Good selectors make tests stable and reduce maintenance effort.
Explain why fragile tests happen and how mastering selectors can prevent them.
Think about how small UI changes affect tests and how better locators help.
You got /4 concepts.
List best practices for writing selectors that reduce test fragility in Selenium.
Focus on locator strategies that survive UI changes.
You got /4 concepts.