|
| Dynamic Functions : | Function Index |
Function
Description:
During playback, if any popup that was
not encountered during recording, appears then it is called unexpected popup
and you can close the same using this function.
How
to Define:
closeUnExpectedPopUp("Window
Title",timeout)
Example:
Return Values:
0 for Success
1 for Failure
doesElementExists
Using this function any HTML element can
be verified for its existance in the webpage.
The Element will be identified based on the configured tagname ,
propertyname and propertyvalue.
The element properties are need not present in the GUI map file.
How
to Define:
doesElementExists(tagName,
propertyName, propertyValue, index, [regExpRequired])
Mandatory Parameters :
tagname = HTML tag name of the element to be identified.
propertyname
= Identification property with which the element can be identified in
the webpage
propertyvalue = Value for the identification property used to match the element in the webpage.
index = Occurrence of the element to match if there are more elements matching the above property name and value.
regExpRequired : If the above configured property value needs to be matched by applying the regular expression or not. To know the details of using regular expressions in property value, refer to the following link.
true
- match the property value with regular expression.
false
- property value will be matched for equals condition.
Example:
For
example, in the below HTML code to check whether the 2nd text element
exists, enter the function as follows:
|
<TR> <TD>text </TD> <TD><input type="text" name="userid" size="20" onclick="alertForAction('button name')" onmouseover="callMouseAction('mouseover',this);" onmouseout="callMouseAction('mouseout',this);"></TD> <TD id="tablecell1">User ID<input type="text" name="userid" size="20"></TD> <TD><input type="text" name="userid" size="20" id="useridid"></TD> <TD><input type="text" name="userid" size="20" id="useridid"></TD> <TD><input type="text" name="useridid" size="20"></TD> <TD><input type="text" name="useridid" size="20" id="userid"></TD> </TR> |
In the above HTML you can find there are
two "input" element exist with the same name name="userid".
To check whether there is second
occurence element exist in the page, use the below function call,
doesElementExists("input","type","text",2,"false")
In the above case,
The first parameter tagName = input
The second parameter propertyName = name
The third parameter propertyValue = userid
The fourth parameter index = 2 since the second text element has to be checked to see whether the element exists or not.
The fiftth parameter regExpRequired = false, since regular expression is not used.
You can also use regular expressions for the 3rd parameter (propertyValue).
regExpRequired accepts "true" or "false" to
support regular expressions. To know the details of using the regular
expressions, refer to the following link.
Return Values:
0 for Success
1 for Failure
Use this function to verify whether any
popup (alert/prompt/confirm) window with the specified title exists
during playback.
How
to Define:
doesPopupExists("Title")
Example:
result =doesPopUpExists("Microsoft Internet
Explorer")
The
above will search for the popup window with title "Microsoft Internet
Explorer" and return success if it is found.
Return Values:
0 for Success
1 for Failure
Function
Description:
Using this function, desired action
can be initiated over the certain HTML element identified through the
arguments to the function. The element details need not present
in the GUI map file.
How
to Define:
Mandatory Parameters
:
tagname = Tag name of the element for which the specified event
has to be fired.
propertyname = Any attribute of the element with which the HTML element can be identified in the webpage.
propertyvalue = value for the above configured attribute of the HTML element
index
= Occurrence of the element in the HTML page. Default value is 1.
actionName
= Specify any one of the action listed below,
Optional Parameters :
useRegExp = Accepts true or false which determines whether to use
regular expression or not to identify the HTML element in the webpage.
If set to true, the attribute value for
identifying the element will be matched by applying the regular
expression.
If
false, property value will be matched for equal condition. To know the
details of using the regular expressions, refer to the following link.
Example:
For
example, in the below HTML code, to fire the click action on the third
button, enter the function as follows.
|
<TR> <TD>button </TD> <TD><input type="button" value="butdup" name="but" onclick="alertForAction('button namedup')"></TD> <TD><input type="button" value="butid" name="but" id="butid" onclick="alertForAction('button id')">/TD> <TD><input type="button" value="butiddup" name="but" id="butid" onclick="alertForAction('button iddup')"></TD> </TR> |
fireEventOnElement("input",
"name", "but", 3, "click",
"","false")
In the above
case,
Return Values:
0 for Success
1 for Failure
Function
Description:
Using this function, desired action
can be initiated over the certain child HTML element of the given
parent HTML element identified through the
arguments to the function. The element details need not present
in the GUI map file.
How
to Define:
Mandatory Parameters
:
tagname = Tag name of the element for which the specified event
has to be fired.
propertyname = Any attribute of the element with which the HTML element can be identified in the webpage.
propertyvalue = value for the above configured attribute of the HTML element
index
= Occurrence of the element in the HTML page. Default value is 1.
childIdentifier = The Child Identifier to identify the child elements
using index or property name.
actionName
= Specify any one of the action listed below,
Optional Parameters :
childPropName = Any attribute of the element with which the HTML element can be identified in the child collection.
childPropVal
= value for the above configured attribute of the HTML element
childIndex
= Occurrence of the element in the HTML page. Default value is 1.
childRegEx
= Accepts true or false which determines whether to use regular
expression or not to identify the child element from the element
collection.
useRegExp = Accepts true or false which determines whether to use
regular expression or not to identify the HTML element in the webpage.
If set to true, the attribute value for
identifying the element will be matched by applying the regular
expression.
If
false, property value will be matched for equal condition. To know the
details of using the regular expressions, refer to the following link.
Example:
For
example, in the below HTML code, to fire the click action on the third
button, enter the function as follows.
| <DIV
name="custom"> <input type="text" size="20" /> <input type="checkbox" /> </DIV> |
fireEventOnChildElement("DIV",
"name", "custom", 1, "elemindex","settext",
"QEngine","NONE","NONE",1,"false","false")
In the above
case,
Return Values:
0 for Success
1 for Failure
Function
Description:
Using this function, any desired property
can be obtained of the certain
HTML element identified through the arguments to the function.
The
element details need not present in the GUI map file.
How
to Define:
getElementProperty("tagName,
"propertyName", "propertyValue","iIndex","propRequired", "useRegExp")
Mandatory Parameters
:
tagname = HTML tag name of the element from which the property
has to be obtained.
propertyname = Any attribute of the element with which the HTML element can be identified in the webpage.
propertyvalue = value for the above configured attribute of the HTML element
Index = Occurrence of the element in the HTML page. Default value is 1.You
can also use regular expressions for the 3rd parameter "property value" wherein useRegExp
must be "true" to support regular expressions. By default, useRegExp is
false. To know the details of using the regular expressions, refer to
the following link.
Example:
For example, in the below HTML code, to
get the value of the innertext say idlink
for the third a href element,
enter the function as follows.
|
<TR> <TD>link </TD> <TD> <a href="http://autotest-server/" id="linkid" onclick="return alertForAction('link id')"><b>idlink</b></a></TD> <TD> <a href="http://autotest-server/" id="linkid" onclick="return alertForAction('link iddup')"><b>idlink</b></a> </TD> <TD> <a href="http://autotest-server/" onclick="return alertForAction('link nci')"><b>linkid</b></a> </TD> <TD> <a href="http://autotest-server/" id="namelink" onclick="return alertForAction('link icn')"><b>idlink</b></a> </TD> </TR> <TR> |
result =
getElementProperty("a", "id",
"namelink", 3, "innertext","false")
In the above case,
Return Value:
Returns the property value as string.
Function
Description:
Use this function to retrieve the
message displayed in a popup window, which can be identified by the
title given.
How
to Define:
result =getPopUpText("<window_title>","<wait_time>")
window_title
-> Title of the popup window from which the message has to be
retrieved.
wait_time -> maximum wait time after which the message has to be
retrieved.
Example:
result =getPopUpText("Microsoft Internet Explorer",6)
displayMessage(result)
Return Values:
String - The message displayed in
the popup window.
Function
Description:
During playback, if any popup that
was not encountered during recording, appears then it is called
unexpected popup. To read the title of the popup window, you can use
this function.
How
to Define:
result =getUnExpectedPopUpTitle()
Example:
result =getUnExpectedPopUpTitle()
displayMessage(result)
Return Values:
String - The title of the popup
window.
|