Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I randomize how long a wait state waits?
#1
Solved: 11 Years, 4 Months ago
Wait (X)

I want X to represent a random value within a parameter. For instance, I want to be able to set my random value to be in between 5 and 500 seconds so that the first time I loop through the Wait (X) that X might equal 121 and the next time it might equal 6 and so on with any valid Wait random value between 5 and 500. Can this be done? Syntax please :-)
Reply
#2
Solved: 11 Years, 4 Months ago
While it can be done easily, I am not sure why you want a hard coded statement in your scripts... a sync statement or a loop which checks for the existence of an object would be better...
anyways here goes the syntax...

Code:
Dim X

X = Int(596 * rnd() + 5) ' This will generate an integer between 5 and 500

wait(X)
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Collecting Objects And Object State At Runtime zunebuggy 3 1,719 11-22-2017, 02:37 PM
Last Post: supputuri
  Default state of new action aparajita 1 2,333 08-25-2015, 12:11 AM
Last Post: aparajita
  QTP Takes Long time to Run prasaad44 4 4,876 04-10-2014, 01:53 AM
Last Post: prasaad44
  select an item from a very long drop down list vijayendra.shukla 0 2,719 12-03-2013, 09:40 PM
Last Post: vijayendra.shukla
  popup window takes a long time bistritapcv 4 3,563 04-17-2013, 09:35 PM
Last Post: bistritapcv

Forum Jump:


Users browsing this thread: 1 Guest(s)