I have encountered issues when I tried to review my captured cases, and I think it was the date picker. First date picker is I tried to select a current or previous date. Second date picker is a birthday. Anyone know how to handle this?
There are many different types of DatePickers to choose from. Perhaps you can show yours so we can see what you are referring to.
It might be like:
Hi, this is the one we used.
Okay, so we would likely need the HTML of the DatePicker to give real information, however, how about not using the Calendar at all. Instead, just set the birthdate into the field and see if that works. If you want more, you can view the thought bubble in the first link of my response above although the DatePicker was somewhat different.
Something like:
import org.openqa.selenium.Keys as Keys
birthDate = "07/12/1974";
"birthdate"
WebUI.delay(1)
// the DatePicker popup window interferes with the fields that are overlaid by it
// so don't click on it; just insert the date (the pop-up still appears)
// and then tab off to next field
WebUI.setText(findTestObject('myPage/input_Basic.DateOfBirth'), birthDate)
WebUI.sendKeys(findTestObject('myPage/input_Basic.DateOfBirth'), Keys.chord(Keys.TAB))
// allow to let the DOB popup to disappear
"status" // field lower on the page than the popup
WebUI.click(findTestObject('myPage/input_Basic.Status'))
WebUI.selectOptionByLabel(findTestObject('myPage/input_Basic.Status'), 'Active', false)
I think you can also recapture the right and left arrows as well as the month and year. These elements are all likely in the DatePicker header and the calendars dates in the body. So, I was thinking you can see if you can get a better path to the header elements if you want to use the DatePicker (you can review the HTML and manually improve the path).
The dates can be used like a web table in which you run up the rows (<tr>
), comparing each date (<td>
) to the one you want until you get a match.