Forum Discussion

cbahn001's avatar
cbahn001
Occasional Contributor
9 years ago

How to use keyword statement While Loop based on if an Onscreen Object is visible?

I am testing a desktop app and trying to use a while loop to run a series of steps if an object is visible on screen, in this case it is an error that shows up if I a username has been used.  Right n...
  • djadhav's avatar
    djadhav
    9 years ago

    Since you say "So basically I am trying to enter a unique record into a database through the application". Can we assume your goal is to have a unique name every time? If yes, then you can eliminate the While loop totally.

     

    There are multiple ways to do this:

     

    Using Project Variables:

    Create a Project Level variable (https://support.smartbear.com/viewarticle/77783/) to keep a track of the last value used to create the name.

    Every time

    1) Fetch the value

    2) Increment it by one and use it to create a unique name

    3) Store the new value back to the Project variable.

     

    Using TimeStamp:

     

    Append this to the Name to get a unique value everytime.

     

    NewValue = OldValue + aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%m%d%y%H%M%S")