How to wait for an element before proceeding - Web Performance
Menu

How to wait for an element before proceeding

When step in a real-browser testcase is performed, the virtual user will wait until the browser indicates the step is complete. For some actions, such as typing text, this is likely to happen very fast. When the action (e.g. submit a form) causes the browser to navigate to a new page, it is finished when the onLoad event is fired for the page. This wait is built into the APIs that Load Tester uses to interface with the browser (Selenium/WebDriver). After that API returns, the step may be configured to wait for an additional condition to be satisfied before proceeding.

Asynchronous events (AJAX) do not prevent the browser from reporting completion. As an example: the page may load and render on the screen, but some AJAX processing in the background loads other data and updates/creates elements on the page as the data become available. When a testcase needs to interact with one of these lazily-updated elements, it may need to wait until the element is click-able (or visible, etc) before it can proceed.

Configuring the completion condition

To make the virtual user wait beyond the browser reporting that the action is complete, the step completion condition must be changed. Open the advanced editor for the step (double-click) and choose the Measurement tab.

WaitCondition

The default completion condition is to wait for the action to complete – and this will always happen regardless of this setting. Changing the completion condition will cause the virtual user to ALSO wait for the specified condition. By configuring the correct condition, the virtual user will wait until the required element exists (or is visible or click-able, as needed) before proceeding to the next step.

The step completion condition also affects the measurement of the step – allowing Load Tester to measure how long it takes for the user to see the completion of an AJAX action.

Copyright © 2024 Web Performance, Inc.

A Durham web design company

×

(1) 919-845-7601 9AM-5PM EST

Just complete this form and we will get back to you as soon as possible with a quote. Please note: Technical support questions should be posted to our online support system.

About You
How Many Concurrent Users