Complete the code to locate the date picker input field by its ID.
WebElement dateInput = driver.findElement(By.[1]("datePicker"));
The id locator is the most direct way to find an element with a unique identifier like "datePicker".
Complete the code to select a date from the date picker by sending keys.
dateInput.[1]("2024-07-15");
To enter a date into an input field, use sendKeys to simulate typing.
Fix the error in the code to wait until the date picker calendar is visible.
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); wait.[1](ExpectedConditions.visibilityOfElementLocated(By.className("calendar")));
The correct method to wait for a condition is until.
Fill both blanks to select a date from a calendar widget by clicking the correct day.
WebElement calendar = driver.findElement(By.className("calendar")); calendar.findElement(By.[1]("[2]"));
Use By.xpath with a proper XPath expression to find the day element inside the calendar.
Fill all three blanks to create a map of dates and their availability status from the date picker.
Map<String, Boolean> availability = new HashMap<>(); for(WebElement day : driver.findElements(By.className("[1]"))) { String date = day.getAttribute("[2]"); boolean isAvailable = !day.getAttribute("class").contains("[3]"); availability.put(date, isAvailable); }
The date cells have class day-cell, the date is stored in attribute data-date, and disabled days have class disabled.