Select a pay period end date dynamically

Hi All,

I have just started using UI path to create some automation to download files from a portal.

Hitting a hurdle with this specific situation. I want the bot to select the pay period end that has already passed and it needs to do the same till the next pay period ends.

For example, Today is 10/30/2019 which means bot needs to select 10/25/2019. 10/25/2019 needs to be selected until 11/08/2019. And say today was 11/09/2019 the bot should pick up 11/08/2019


Hope that provides some level of clarity.

Thanks in advance.


Is this an instance where you can grab a selector from the drop-down? Can you post a screenshot of the selector if that is the case, try using this new technique to grab the selector once defined as a variable.
How to use variables in selectors in Studio (dynamic selectors) without string manipulation!

Welcome to uipath community
There are actually two ways to handle this situation
We can use either SELECT ITEM activity in this where select that drop down as a element and so that we could be able to choose the date we need from that by passing the value as a string
If the field takes typing the value and then a enter press key can choose it if possible
Then we can type in the date value as a string input to TYPE INTO activity and followed by that we can use send hot key activity with key as enter

Hope this would help you
Cheers @arsh

Hi @Palaniyappan ,

I have been trying this out with select item for sometime today. I am facing difficulty with the string logic.
What logic would I write to select 10/25/2019 as that is the latest period end?

@arsh - There are multiple ways to solve, but I would go about it like this:

  1. Use Find Children activity on the dropdown box and get all of the elements. I’ll call this AllDateElements
  2. Create a List variable (of type string) with an assign activity. I’ll call this AllDateValues. Assign AllDateValues = new list(of string)
  3. Use a for each loop on the AllDateElements (be sure to change TypeArgument to UiPath.Core.UiElement).
    a. Use a ‘Get attribute’ activity. Pass in ‘item’ (or whatever you named the variable in the for each loop) in the Target–>Element property. Save the output to a string variable I’ll call tempDateValue.
    b. Use ‘add to collection’ activity. The properties for this activity are - Item: tempDateValue // Collection: AllDateValues
  4. Create a new datetime value i’ll call CurrentDate. Assign CurrentDate = today
  5. In a While loop (NOT a Do While loop) with the condition being: Not(AllDateValues.Contains(CurrentDate.ToString("MM/dd/yyyy")))
    a. CurrentDate = CurrentDate.AddDays(-1)
  6. Use a select item activity. Item attribute should be: CurrentDate.ToString(“MM/dd/yyyy”)

it sounds complicated, but can be accomplished relatively easily in studio and should run in a second or less. Please let me know if you have any questions. If you aren’t able to follow the text-only answer like this I could put something together in studio as well - although it won’t be able to be tested since I don’t have the same dropdown list of dates available to me

1 Like

Kindly explain this login again pls
Sorry I don’t get this in exact
Cheers @arsh

@Dave. Thank you for the detailed response. I have tried to together the steps that you have explained but I could not get it running because of some errors.

Could you review and see if the logic makes sense.

DateSelectSequence.xaml (12.5 KB)

1 Like

I attached me updated version here with corrections. Dave updates - DateSelectSequence.xaml (12.3 KB)

  1. Find Children - the output is in quotes. This needs to be output to a IEnumerable<UiElement> type variableinstead
  2. AllDateValues - this is currently a string variable. It needs to be a List type variable instead
  3. The first for each needs to iterate over AllDateElements, not the AllDateValue variable
  4. Get Attribute - You need to specify the attribute. This is the name of the attribute you want, it can be found using UiExplorer. I’m guessing you want “innertext” but am not 100% sure, you will have to confirm that yourself.
  5. Get Attribute - you need to save the output result to a string variable. Right now you typed in tempDateValue but you need to create a string variable with the same name
  6. Add to collection activity - I was trying to help with the attributes. When i typed item: tempDateValue that meant in the item property, you should put tempDateValue. I have updated this.
  7. Add to collection activity - the TypeArgument needs to be string
  8. Assign CurrentDate - you need to create a DateTime variable to store this in. You never declared it.
  9. Assign CurrentDate - this needs to be done outside the for each loop.
  10. While loop - your condition wasn’t valid because it was missing the final close parenthesis )
  11. While loop - you forgot to put in the assign activity for CurrentDate = CurrentDate.AddDays(-1)
  12. Select item - this should not be in the while loop, it must come after the loop
  13. Select item - you need to put in the CurrentDate.ToString(“MM/dd/yyyy”) as the item you are selecting
  14. I removed excess sequences that weren’t being used.

NOTE: I did not verify or validate any of the selectors you are using. You are responsible for making sure the selector used in the ‘find children’ and ‘select item’ activities are correct


First you have to write a logic to get the Date, like it will be get today’s date and add 15 days if its sunday add +1 or something like that, and when you get the final date which you have to select as a string then use select item options.

@Dave You are the best. Thank you for all the detailed explanations. This process of dealing with pay periods is so damn helpful now and going forward

1 Like

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