Recall & Review
beginner
What is a date picker in web testing?
A date picker is a user interface element that allows users to select a date from a calendar popup or dropdown. In testing, it requires special handling to select dates correctly.
Click to reveal answer
beginner
Name two common strategies to automate date picker selection in Selenium.
1. Directly inputting the date string into the date field if allowed.<br>2. Navigating the calendar UI by clicking next/previous buttons and selecting the date element.
Click to reveal answer
intermediate
Why might directly sending keys to a date picker input fail?
Because some date pickers are read-only or use custom UI controls that ignore keyboard input, so sending keys won't update the date properly.
Click to reveal answer
intermediate
How can you handle dynamic calendar UI elements in Selenium for date pickers?
By locating calendar controls using stable locators like aria-labels or data attributes, then using loops to navigate months and select the correct day element.
Click to reveal answer
beginner
What is a best practice when writing locators for date picker elements?
Use unique, stable attributes such as aria-labels, data-* attributes, or visible text instead of brittle XPath or CSS selectors that rely on position.
Click to reveal answer
Which strategy is best if the date picker input field is editable?
✗ Incorrect
If the input field accepts text, sending keys is the simplest and fastest way to set the date.
What is a common problem when clicking calendar UI elements in Selenium?
✗ Incorrect
Calendar elements may load dynamically or be hidden, so waits or checks are needed before clicking.
Why avoid using absolute XPath for date picker elements?
✗ Incorrect
Absolute XPath depends on exact UI structure, which often changes, making tests fragile.
Which locator attribute is best for accessibility and stable selection?
✗ Incorrect
aria-label attributes describe elements for screen readers and are usually stable and unique.
What should you do if the date picker uses a custom widget that blocks keyboard input?
✗ Incorrect
Clicking through the calendar UI simulates user behavior and works with custom widgets.
Explain how you would automate selecting a date in a date picker that does not allow typing.
Think about how a user clicks through the calendar to pick a date.
You got /4 concepts.
List best practices for writing locators for date picker elements in Selenium.
Focus on locator stability and accessibility.
You got /4 concepts.