Skip to main content

SeeTestAutomation- WaitForElement

info

Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .

WaitForElement(String Zone, String Element, int Index, int Timeout)

Description

Sets sleep until element is identified.

Parameters

  • Zone: Select Zone
  • Element: Query to identify the objects/Name of the element on the object repository.
  • Index: Element Order (the number of times the element appears more than once). Index=0 refers to the first appearance of the element; Index=1 refers to the second appearance of the element, etc.
  • Timeout: Waiting Timeout in milliseconds.

Usage

Scenario: On the following scenario we will try to create an account on gmail.com.
We will see that it might take time to load the page, so by adding a step of waitForElement the test stability is improved.

Step 1: Launch google.com using the chrome browser.

Step 2: Click the create an account button.

Step 3: Fill in name on Name text field.

Test:

**

**

Web page was not  fully loaded. Element was not identified before the click command's timout which resulted on the test failing.

How to resolve this issue

We will use the WaitForElement command. SeeTestAutomation will wait for the element and it will not move to the next step.

Code Examples

Java Example

client.waitForElement("WEB", "id=FirstName", 0, 10000)

C# Example Expand source

client.WaitForElement("WEB", "id=FirstName", 0, 10000)

VBScript Example Expand source

client.WaitForElement ("WEB", "id=FirstName", 0, 10000)

Python Example Expand source

self.client.waitForElement("WEB", "id=FirstName", 0, 10000)    

Perl Example Expand source

$client->waitForElement("WEB", "id=FirstName", 0, 10000)