0

Do you know any Keyword or any Logic in Robot Framework to get the last day of the Each month. Actually, I am working on a Calendar and in that Whenever it will be last day of the month I need to click on Next Button.

Thanks in Advance!

Akhil
  • 1
  • 1
    You can build a keyword around the answers here: [How to get the last day of the month?](https://stackoverflow.com/questions/42950/how-to-get-the-last-day-of-the-month) – Bryan Oakley Jun 24 '22 at 17:41

1 Answers1

1

Python's calendar library can provide this information.

In your Robot test script you can call calendar.monthrange(year, date) which will return a list of two numbers, the 0th element is the weekday of the first day of the month, and the 1st element is the days in the month.

In example

${year}=    Set Variable    2022
${month}=    Set Variable    2   
${tupleContainingEndDate}=    Evaluate    calendar.monthrange(${year}, ${month})
${numberOfDays}=    Set Variable    ${tupleContainingEndDate}[1]
Log    ${numberOfDays}

${numberOfDays} is: 28

kiwimatt
  • 11
  • 2