While Loop Codition

Hi Folks, This is my while condition, MonthIn variable is my input month and CurrentMonth is my scrapped month from the web.

U can see my input month is not equal to the Current month then will click to next month.
When my input month and Current month is equal then should be stopped to click the next button, but this clicking till disappear next button

1 Like

Hi @Naveen_Kumar2,

Actually, the condition which you have implemented I hope it will run in a wrong way. Instead, try this expression, Month.Equals(CurrentMonth),i.e., this expression will return true if months are equal, then in the true block, leave empty, in the else use the click to next month process flow.

I hope this would sort out your problem



You need to scrape the CurrentMonth again inside the While-loop after you have clicked Next month. If you don’t do that values for your variables will never change which results in an infinite loop.

1 Like

I have did, but not working,
This is doing same what I am mentioned above.


We need to validate first how the month actually looks like

Let’s try with a normal approach and then will deep dive based on the outcome you get

Try with this expression in your while loop

If your month is a string like this January or Jan

NOT MonthIn.ToString.ToUpper.Trim.Contains(CurrentMonth.ToString.ToUpper.Trim)

If it’s a numerical value like this 01 or 11

Then try with this

NOT MonthIn.ToString.Trim.Contains(CurrentMonth.ToString.Trim)

Cheers @Naveen_Kumar2

1 Like

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