Wait script action

Wait action

A Wait action adds a delay to the execution of a script to enable some event to occur or to finish completely. Once that event is completed, the script resumes execution. The Wait action settings define the event that enables the script to continue.

For each Wait action, you can select an option that displays a vertical blue line in the waterfall chart that indicates when this wait event completes. This feature can be useful for troubleshooting and/or visualizing DOMReady and Load events.

Best practices

A Wait action should be placed before the end of a step, after the action for which the Wait is needed. For example, a Wait for Page Complete after a Click action that results in going to a new page.

Best practice is to end each step with a Validate action to ensure that the step executed properly. Note that this Validate is a separate action, not the Wait for Validate criterion in a Wait action. The Wait action and Validate action should not be the only actions in a step.

Of the different Wait criteria (described below), Network and Page Complete are generally the only types you will need to use.

Wait for Network should be used after a Click action that does not result in a new page being loaded; and anywhere you need to make the script slow down and wait for network activity to complete.

Wait for Page Complete should generally be used after a Click action when the action results in a new page being loaded; or as the last wait of a step.

Wait for Time should only be used as a last resort when neither Wait for Page Complete nor Wait for Network is able to slow the script down enough before proceeding to the next step.

Wait for Validate is used to make sure a specific locator or text string is present before moving to the next action in the script.

Wait for Event is rarely used. However, it can be helpful in specific use cases, as described below.

If you need to use more than one Wait action in a Step, we recommend the following order:

  1. Wait for Validate
  2. Wait for Page
  3. Wait for Network
  4. Wait for Time

If your script has errors while playing back, check to make sure the Wait actions are waiting long enough before the script tries to continue. You can use the action settings to add wait time.

Keep in mind that the amount of time your script waits will count towards the Hard Deadline (the default timeout is 90 seconds for a step and 240 seconds for the script). You should use the fewest Waits necessary. If your script exceeds the Hard Deadline, it will receive a Hard Deadline timeout. Your data for that transaction will be reclassified and will not be available to view in the Portal.

Customer Support is able to increase the Hard Deadline limit by a marginal amount. If you believe that your script needs to be optimized, open a Support ticket. If necessary, Support may adjust the script according to scripting best practices to help you optimize your results.

Wait criteria

Select one of the following from the Criteria list for the Wait action:

Depending on the wait type, you may not be able to change some options.

Validate

For the Validate criterion, the script waits for validation that the specified text is present in a specified element of the step. You can also enter a timeout value. Element locators are captured and can be edited when necessary.

Define these settings:

  • Criteria – Select Validate.
  • Maximum time to wait – The default is 30 seconds.
  • Match Text – Enter the text to be matched.
  • Target Window – The default is gomez_top[0].
  • Locators – Use the locators to specify the element that contains the text. For more information, see Element locators.
  • Wait until a match does not exist – Fail the script if the text matches in the specified mode. Normally, a validation fails the script if the specified text does not match.
  • Interpret as regular expression – Interpret the specified text string as a regular expression.

Wait for validate settings

Page Complete

For the Page Complete criterion, the script waits for the entire page to load. This is the wait criterion used by most navigation, such as the Navigate action and when clicking on a link.

The following diagram shows the wait for page workflow.

Define these settings:

  • Criteria – Select Page Complete.
  • Maximum time to wait – The default is 60 seconds.
  • Page Complete Delay– This setting specifies how long the script waits after the page is loaded for additional network activity. The default is 250 milliseconds.
  • Pending Read Wait– This setting specifies how long a network connection is quiet before the script continues to the next action. The default is 3000 milliseconds (3 seconds).

Wait for page complete settings

Network

For the Network criterion, the script waits for all network operations to finish; for example, if a search engine returns suggestions as the user enters text in a search field. This causes a wait for network activity but not a page load. Specify a maximum time, in seconds, to wait.

Define these settings:

  • Criteria – Select Network.
  • Maximum time to wait – The default is 60 seconds.

Wait for network settings

Time

For the Time criterion, the script waits for exactly the specified time, entered in seconds. Use this setting in your script to simulate user "think time" by waiting after a page loads before going on to the next action.

Define these settings:

  • Criteria – Select Time.
  • Time to wait – Specify the time in seconds.

Wait for time settings

Event

For the event criterion, the script waits for an event to occur on a particular window, for example, a popup closing may be the event you have to wait for before executing further actions on a page.

Define these settings:

  • Criteria – Select Event.
  • Event Type – This type of event waits for either the DOMReady or the Load event of the browser window.
  • Maximum time to wait – Specify the time in seconds. The default is 60 seconds.
  • Target Window – The default window is gomez_top[0].

Wait for event settings