Classic Click Activity dynamic aaname with variable

Hi guys, I am trying to use the classic click activity on a website, and every file in the selection has a date associated to it. The file I want to click has the current date on it, and ignore the detailed time at which it was updated.
Here are the selectors:

image

I have tried to set aaname to ‘MRB_DateToday.xlxs *’, where DateToday is a variable for today, and I cannot validate the selector.
May I know how should i input this? Thanks!

@Hou_Paang_Soul

‘MRB_DateToday.xlxs is a string datatype or you change the datatype

1 Like

Hi @Hou_Paang_Soul

Try this:
‘*MRB_{DateToday}.xlsx*’

1 Like

Hi @Hou_Paang_Soul

Try to save it in a variable and then pass it.

"<webctrl aaname='MRB_" + DateToday + ".xlxs' />"

1 Like

Hi @Hou_Paang_Soul
Store the today’s date in a variable and pass it in the selector.

Hope it helps!!

1 Like

@Hou_Paang_Soul

You may try to change other options like “Inner Text” if it contains MRB_DateFormat

1 Like

Hi @Hou_Paang_Soul - The format of aaname in the selector should be

"MRB_DateToday.xlsx.*"
  • You have already created a variable called DateToday pass the default value to this variable as the current date in the variables panel. Also, you must define this variable in your sequence as DateTime.Now.ToString("ddMMMyyyy"). This way while executing the sequence the current date assigns to the variable and the same one will pass into the selector
    Ex: 27Jul2023
  • Now go back to your selector and validate it. It should highlight the respective element in your application if the selector matches

is that mean the validate option is not available or is the selector is not getting validated

1 Like

@Hou_Paang_Soul
If we use today itself ,it read with the time too.
So,Use as below

Pass the variable in the selector

Hope it helps!!

1 Like

@Hou_Paang_Soul

Store the today’s date in a variable as below by using assign activity

TodayDate = DateTime.Today.ToString("ddMMMyyy")

So after storing the date in variable pass the variable in place of value belong to aaname attribute as shown below

"<webctrl aaname='MRB_" + TodayDate + ".xlxs' />"

Hope it works!!

1 Like

@Hou_Paang_Soul

As per the screenshot this should help you

<webctrl aaname='MRB_{{DateVar}}.xlsx*' tag='OPTION' />

Create a datevar variable of type string and assign the value as Now.ToString("ddMMMyyyy")

for validating add the default value as 27Jul2023

cheers

1 Like

@Hou_Paang_Soul

If you find the solution please do mark as solution to close the loop.

regards

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.