If anybody could help in selecting the Time Range in a dropdown as mentioned below according to system time (7-8pm if 7.30pm is time of system)?

image

@anjasing

Can you share the selector of the element?

Thanks

image deleted

Now.Hour will give you current hour. Now the time is 19:49, so Now.Hour gives you 19. Convert the output of this command to 12 hour format(if num>12, reduce 12 from that num). Then you can understand that you should select 7:00PM - 8:00PM(store this value in a variable) dropdown element. Tweak the selector tags with this variable.

Click on a dropdown element, get the selector and open it in UI explorer and check if there’s any property called aaname and if it’s showing any timing values. Then if you can share that selector, I can try to figure out what needs to be adjusted

1 Like

it’s coming like this in uipath explorer with aaname, showing time. Now how to put timeRange (as variable)value here

image deleted

1 Like

ok. As I said in my previous reply get the current hour, store it in a string variable(say var1). Convert it to format ‘Today, 7:00PM - 8:00PM’ using the logic like below:
if current hour(var1) is 19, then you should convert this 19 to 7(store in variable, say var2) and also create a variable(say var3) to add 1 to the current hour(be careful here, if current hour is 12, you shouldn’t make it 13). This will give you the values 7 and 8. Now modify var1 to “Today,” + var2 + ":00 PM - " + var3 + “:00 PM”

Now in the UIexploer, click on the checkbox near aaname, then it’ll be a part of your selector.
Now right click on the value of aaname tag(if it’s like aaname=‘Today,7:00PM-8:00PM’, then select this text Today,7:00PM-8:00PM and right click),
Then click on choose variable and then choose variable var1

Save the selector from UiExplorer and test your automation

3 Likes

It worked :slight_smile: Thank you so much :slight_smile:

1 Like

@Surya_Narayana_Korivipadu - Just a suggestion - Instead of hard coding AM or PM below code will work for any cases…

image

2 Likes

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