On a web page I have two date fields (startdate, enddate). I cannot enter the date text directly, but they have popups with date selection. So I need to click on month, year and day fields.
The two date fields have the locators id=session-date-start and id=session-date-end. But the xpaths of popup month, year and day are identical for start and end date. So instead of clicking on the fields month, year, day of start date the systems clicks on the fields of end date.
I am using following commands to click on the start date. Sometimes it works, sometimes it selects the end date instead.
{
“Command”: “click”,
“Target”: “id=session-date-start”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="ui-datepicker-div"]/div/div/select",
“Value”: “”,
“Description”: “”
},
{
“Command”: “select”,
“Target”: "xpath=//[@id="ui-datepicker-div"]/div/div/select”,
“Value”: “label=${startdate_month}”,
“Description”: “Start Monat”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="ui-datepicker-div"]/div/div/select[2]",
“Value”: “”,
“Description”: “”
},
{
“Command”: “select”,
“Target”: "xpath=//[@id="ui-datepicker-div"]/div/div/select[2]”,
“Value”: “label=${startdate_year}”,
“Description”: “Start Jahr”
},
{
“Command”: “click”,
“Target”: “linkText=${startdate_day}”,
“Value”: “”,
“Description”: “Start Tag”
}
Any ideas how to solve this?