Ajax Functions

Description : Ajax Functions can be used to handle dynamic nature of the application. With the use of AJAX functions, QEngine can be made to wait until specific HTML element to appear / disappear in webpage and then proceed to do further intended actions recorded in the webscript. The timeout value configure can control the maximum time to wait for the element.

Where the AJAX Functions can be used ?

Following is the scenario which will be automatically QEngine can handle,

Following is the scenario where AJAX functions will be useful,

How to enable AJAX element handling ?

Following are the various functions available in the AJAX Functions category,
  1. enableWaitForElement
  2. setWaitTimeForElement
  3. waitForDynamicElement
  4. waitForDynamicElementRemoval
  5. waitForElement
  6. waitForElementRemoval
  7. waitForText
  8. waitForTitle

enableWaitForElement

Function Description:

Using this function you can enable / disable AJAX element handling in the runtime.  During playback, the test waits until the element is loaded or identified for each of the user actions placed after the enableWaitForElement(). You can use the first parameter of this function to enable/disable the wait time action for specific user actions. The parameters include:

1st argument - Accepts true or false to enable or disable the wait time action for specific user actions.

2nd argument - The maximum time to wait in seconds.

How to Define:

enableWaitForElement(enable/disable,wait_time_in_secs)

Example:

Eg: enableWaitForElement("true",15)

In the above example the AJAX element handling is enabled and the timeout for maximum wait is set as 15 secs.

Return Values:

0 for Success

1 for Failure

 Top


setWaitTimeForElement

Function Description:

 This function is used in relation to the enableWaitForElement(). Use this function to set the timeout value (increase/decrease the value) to maximum wait time until the specified HTML element is loaded or identified. This function should be inserted just before the user actions for which you need to wait until the HTML elements are loaded/identified.

 How to Define:

 setWaitTimeForElement(wait_time_in_secs)

 Example:

 enableWaitForElement("true",10)

clickButton("Button1",2)

clickLink("Link1",2)

setWaitTimeForElement(20)

clickButton("Button2",2)

 In the above example, initially the maximum wait time to identify the button element Button1 is 10 seconds. The setWaitTimeForElement() is used to increase the maximum wait time for the next clickButton() which is 20 seconds wherein the test will wait for a maximum of 20 seconds to identify the button element Button2.

 Return Values:

 0 for Success

1 for Failure

 Top


waitForDynamicElement

 Function Description:

 During playback, the test waits until the HTML Element with the given tag name and matching property name and value is identified. The parameters include:

 tagname = Tag name of the HTML element to be identified.

propertyname = Property name of the HTML element to be matched.

propertyvalue = Property value of the HTML element to be matched. The property value can also be given as a dynamic property using regular expressions. i.e., when the properties in your HTML page changes each time the script is replayed.

index = Occurrence of the element in the HTML page.

useRegExp =  Accepts true or false which determines whether to use regular expression or not.

If false, property value will be matched for equal condition. To know the details of using the regular expressions, refer to the following link.

wait_time in secs = The maximum time to wait in seconds.

 How to Define:

 waitForDynamicElement("tagName", "propertyName", "propertyValue", index, "useRegExp", "wait_time")

 Example:

 Eg: waitForDynamicElement("input", "type", "button", 2, "false", 15)

 Return Values:

 0 for Success

1 for Failure

Top


waitForDynamicElementRemoval

 Function Description:

 During playback, the test waits until the specified HTML Element with the given tag name and matching property name and value, is removed from the HTML page. The parameters include:

 tagname = Tag name of the HTML element to be identified.

propertyname = Property name of the HTML element to be matched.

propertyvalue = Property value of the HTML element to be matched. The property value can also be given as a dynamic property using regular expressions. i.e., when the properties in your HTML page changes each time the script is replayed.

index = Occurrence of the element in the HTML page.

useRegExp =  Accepts true or false which determines whether to use regular expression or not.

If false, property value will be matched for equal condition. To know the details of using the regular expressions, refer to the following link.

wait_time in secs = The number of seconds to wait to identify the specified HTML element.

 How to Define:

 waitForDynamicElementRemoval("tagName", "propertyName", "propertyValue", index, "useRegExp", "wait_time")

 Example:

 Eg: waitForDynamicElementRemoval("INPUT", "type", "button", 2, "false", 15)

 Return Values:

 0 for Success

1 for Failure

Top


waitForElement

 Function Description:  

 During playback, the test waits until the specified HTML Element with the given Element ID is identified. The parameters include:

 Element ID = The HTML element ID which has to be identified.

wait_time = The maximum time to wait in seconds.

 How to Define:

 waitForElement("Element_ID", "wait_time")

 Example:

 Eg: waitForElement("department_1",15)

 Return Values:

 0 for Success

1 for Failure

Top


waitForElementRemoval

 Function Description:  

 During playback, the test waits until the HTML Element with the given Element ID is removed. The parameters include:

 Element ID = The HTML element ID which has to be removed.

wait_time = The maximum time to wait in seconds.

 How to Define:

 waitForElementRemoval("Element_ID", "wait_time")

 Example:

 Eg: waitForElementRemoval("department_1",15)

 Return Values:

 0 for Success

1 for Failure

Top


waitForText

 Function Description:  

 During playback, the test waits until the specified search text (with the given prefix and suffix text) appears in the HTML page that is identified in the last user action. The parameters include:

 Search_String = The text to be searched in the HTML page.

Prefix_String = The prefix string using which the search string has to be searched for.

Suffix_String = The suffix string using which the search string has to be searched for.

 How to Define:

 waitForText("Search_String", "Prefix_String", "Suffix_String", "Time_Out")

 Example:

 Eg: waitForText("Configure","Device","Parameters")

 Return Values:

          0 for Success

1 for Failure

Top


waitForTitle

 Function Description:  

 During playback, the test waits until the specified window with specified title appears. The parameters include:

 Window_Title = The window title to be searched.

Window_Index = The occurrence of the window, if there are one or more windows with the specified title exist.

Time_Out = The maximum time to wait in seconds until the specified window title is identified.

 How to Define:

 waitForTitle("Window_Title", Index, Timeout_Value)

 Example:

 Eg: waitForElementRemoval("AdventNet_Payroll", 1, 15)

 Return Values:

 0 for Success

1 for Failure

Top


 



Copyright © 1999, AdventNet Inc. All Rights Reserved.