Search code examples
pythonseleniumrobotframeworknumericalphanumeric

How to validate an integer user input with minimum length 1 and maximum length 32 using robot framework


How to validate an integer user input with minimum length 1 and maximum length 32 using robot framework ?

<input type="number"/

Length should be 1 to 32 inclusive.

Thank you!


Solution

  • try to use BuiltIn library:

    Validate Length Should Be True
       ${length} =  Get Length    ${result}         #Here we get length of your input
       Log    ${length}                             #Here we can check what is the length (it is not necessary)
       ${status} =  Evaluate  0 < ${length} < 33    #Here we evaluate that input is more than 0 and less that 33 and get status (True or False)
       Should Be True    ${status}                  #Here we validate that status should be true. If number is between 1-32 inclusive test will pass
    
    *** Variables ***
    ${result} =   1123423452346   #Here you can paste your input
    

    let me know if it helped, if not, I will think about another solution :)