Question

How to select a particular date from a date picker grid?


Badge +2

Hi,

As part of my automation tasks on a remote desktop machine application, I have to select a date from a date picker grid. Moreover, I want to be able to select it based on the value. So, if today is the 20th, I want to be able to select 20 from the grid. Also, I want to make this repeatable so that tomorrow when the date becomes 21, then the script should automatically select 21 without making any changes to the script.

This is how the Date Picker grid looks like -:

 

 

Can anyone please help me regarding this?

 

Thanks in advance,

Ramesh Rangarajan


11 replies

Badge +3

hello @Ram 4045 

let us assume you keep the today date inside variable nToday, let it has the value 19 for example,

try to capture the today element for example 19 using recorder,

then select click action in Action to take on object property.

later, try to look at the DOMXPath property and inject nToday inside it.

for example

//ngb-datepicker-navigation[1]/ngb-datepicker-navigation-select[1]/$nToday$ 

please have a look at the following video. 

https://www.youtube.com/watch?v=wxzjSe93ru4&t=428s&ab_channel=AiFective

good luck

 

 

 

 

 

Badge +2

Hi @azzmi ,

 

Thanks for your reply.

However, I am automating a desktop application. The date picker exists as part of a desktop application. So, how would I be able to access the DOMXPath property, because that exists only for websites, I believe?

 

Thanks,

Ramesh Rangarajan

Badge +3

yes, got it..

try the following

it is captured on button 7, but we clicked the 5 button .. 

we updated the Name field ….

good luck

Badge +2

Hi @azzmi ,

For the calculator control, the “Name” property is being sensed, but for my Datepicker control, even if I insert a value for the “Name” property, the BOT is unable to locate that element in the Datepicker control.

So, while capturing i clicked on 20, but then set the “Name” property value of that captured object to 27 through a variable, but the BOT fails at that step and gives following error -:

Unable to perform 'Left click' action. Object is not found, search criteria didn't match.

JFYI -: I had earlier tried to extract the “Name” property value under the “Get property” action for that same element and display it in a message box… but it would always display the text “Input Capture Window” as the value for the “Name” property.

Going by that, I assume that this object always has its “Name” property set to “Input Capture Window” because of which, even if I change the value to a particular date, it is not able to locate that object in the date picker and so fails.

Any workaround to this problem?

By the way, I am using the “Recapture object with Microsoft UI automation (COM)” feature to capture the objects.

Please advise.

Thanks,

Ramesh Rangarajan

Badge +3

do not you have any ability to recognize the clicked element?

Badge +2

That is what I do not know. I do not know which property of the clicked element returns the display value.

So, If I clicked on 20 while capturing, how to extract that text 20?

If I knew that, I can then set that property value to the desired value and then run the BOT.

I tried setting all relevant properties to the desired value which I want to click on the date picker grid, but the BOT is unable to locate that object.

Badge +3

this is Strang, can provide image of the control? ..

Badge +2

 

Badge +3

I ca’nt help more with this image alone.. is this app available ..so can install and investigate?

Badge +2

Sorry no, this is an application that runs on a remote desktop machine and so is confidential.

Badge +3

yes i see, good luck.

Reply