Description : HTML Get Functions are used to retrieve
value from a HTML element to use it inside the webscript /
programatical verification of the value.
Where the HTML Get Functions can be
used ?
Following is the scenario
where HTML Get Functions can be used,
- To get the value present in the HTML text field.
- To get the value selected in a select combo.
- To get the web page text contained between given prefix / suffix
string.
How to insert HTML Get Functions in
the script ?
HTML Get functions should be inserted while recording the
script. During recording to insert HTML Get Function follow the
below steps :
- Click the "Insert Built-in Function" link available above the
script editor
- In the Function Category combo select "HTML Get Functions" from
the list.
- In the Functions Combo select the appropriate get
function and click on "Click to Proceed" link.
- Select the appropriate element from the web page from which the
value needs to be retreived.
- Choose the property whose value needs to be retrieved from the
property combo.
- After providing the above details click on "Paste" to add the get
function in to the script.
Following are the various HTML Get functions available in QEngine :
linkGetInfo
Function
Description:
To retrieve the value of the specified
property of a link object.
How
to Define:
result
= linkGetInfo("Object
ID", "property")
objectID
= Generated by QEngine.
property
= Property to be retrieved.
With Dynamic
Property: If you need to overwrite (or dynamically change) the
identification property for the HTML Element during playback then you
can use the four arguments method as follows:
linkGetInfo("Object ID",
"property", "<property_name>","<property_value>") where
property name is the identification property such as "id" or
"innertext" and property value is the value to be overwritten during
playback.
Example:
result=linkGetInfo("www.adventnet.com","innertext")
displayMessage(result)
Return Value:
Value of the specified property
Top
editGetInfo
Function
Description:
To retrieve the value of the specified
property of a text object.
How
to Define:
result
= editGetInfo("Object
ID", "property")
objectID
= Generated by QEngine.
property
= Property to be retrieved.
With Dynamic
Property: If you need to overwrite (or dynamically change) the
identification property for the HTML Element during playback then you
can use the four arguments method as follows:
editGetInfo("Object ID",
"property", "<property_name>","<property_value>") where
property name is the identification property such as "id" or "name" and
property value is the value to be overwritten during playback.
Example:
result=editGetInfo("yourname","value")
displayMessage(result)
Return Value:
Value of the specified property
Top
imageGetInfo
Function
Description:
To retrieve the value of the specified
property of an image object.
How
to Define:
result = imageGetInfo("Object ID",
"property")
objectID = Generated by QEngine.
property = Property to be retrieved.
With Dynamic
Property: If you need to overwrite (or dynamically change) the
identification property for the HTML Element during playback then you
can use the four arguments method as follows:
imageGetInfo("Object ID",
"property", "<property_name>","<property_value>") where
property name is the identification property such as "id" or "src" and
property value is the value to be overwritten during playback.
Example:
result=imageGetInfo("http://www.adventnet.com/images/free-edition-appmanager.gif","source")
displayMessage(result)
Return Value:
Value of the specified property
Top
buttonGetInfo
Function
Description:
To retrieve the value of the specified
property of a button object. The object can be a push button, radio
button, checkbox, submit and reset..
How
to Define:
result = buttonGetInfo("Object ID",
"property")
objectID = Generated by QEngine.
property = Property to be retrieved.
With Dynamic
Property: If you need to overwrite (or dynamically change) the
identification property for the HTML Element during playback then you
can use the four arguments method as follows:
buttonGetInfo("Object ID",
"property", "<property_name>","<property_value>") where
property name is the identification property such as "id" or "name" and
property value is the value to be overwritten during playback.
Example:
result=buttonGetInfo("gender","defaultChecked")
displayMessage(result)
Return Value:
Value of the specified property
Top
selectGetInfo
Function
Description:
To retrieve the value of the specified
property of a single selection and multi selection list box (combo box)
object.
How
to Define:
result = selectGetInfo("Object ID",
"property")
objectID = Generated by QEngine.
property = Property to be retrieved.
With Dynamic
Property: If you need to overwrite (or dynamically change) the
identification property for the HTML Element during playback then you
can use the four arguments method as follows:
selectGetInfo("Object ID",
"property", "<property_name>","<property_value>") where
property name is the identification property such as "id" or "name" and
property value is the value to be overwritten during playback.
Example:
result=selectGetInfo("department","selectedcount")
displayMessage(result)
Return Value:
Value of the specified property
Top
listGetInfo
Function
Description:
To retrieve the value of the specified
property of an <LI> element and <DIV> element.
How
to Define:
result = listGetInfo("Object ID",
"property")
objectID = Generated by QEngine.
property = Property to be retrieved.
With Dynamic
Property: If you need to overwrite (or dynamically change) the
identification property for the HTML Element during playback then you
can use the four arguments method as follows:
listGetInfo("Object ID",
"property", "<property_name>","<property_value>") where
property name is the identification property such as "id" or "name" and
property value is the value to be overwritten during playback.
Example:
result=listGetInfo("list1","value")
displayMessage(result)
Return Value:
Value of the specified property
Top
pageGetInfo
Function
Description:
To retrieve the value of the specified
property of the selected page.
How
to Define:
result = pageGetInfo("Object ID",
"property")
Example:
result=pageGetInfo("AdventNet Payroll
System Package - Form to Add Employee Details","response_time")
displayMessage(result)
Return Value:
Value of the specified property
Top
getElementWithFocus
Function
Description:
To get the property value of the
currently focussed HTML element for
the given property name.
How
to Define:
result = getElementWithFocus("<PropertyName>")
Example:
result=getElementWithFocus("innertext")
displayMessage(result)
To get the innertext of the currently
focussed element.
Return Value:
String
Top
getElementIdentifier
(deprecated)
getElementProperty()
Function
Description:
To get the value for the specified
property of a given HTML Element. Supports regular expressions.
How
to Define:
getElementProperty("tagName,
"propertyName", "propertyValue","iIndex","propRequired", "useRegExp")
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.
getElementProperty("a", "id",
"namelink", 3, "innertext","false")
|
<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>
|
In the above case,
The first parameter
tagName = a
The second parameter
propertyName = id
The third parameter
propertyValue = namelink
The fourth parameter
index = 3
since the third a href element value has to be retrieved.
The fiftth parameter
propRequired =
innertext
The sixth parameter
useRegExp = false,
since regular expression is not used.
The above function retrieves the
innertext of a link element whose id="namelink".
Return Value:
Returns the property value as string.
Top
getHTMLElementCount
Function
Description:
To get the count of the given HTML
element with the specified property value.
Supports regular expression
How
to Define:
getHTMLElementCount("tagName","propertyName",
"propertyValue",useRegExp)
Mandatory
Parameters:
1.
tagName = the HTML tag name such as A, input, etc.
Optional
Parameters:
1.
propertyname = specify the property name such as name, src, value, etc
whose count has to be retrieved.
2.
propertyvalue = specify the property value for the property name given
in the second argument whose count has to be retrieved.
3. useRegExp =
Accepts true or false. If true, specify the property value in regular
expression format to support regular expressions. By default, useRegExp
is false. To know the details of using the regular expressions, refer
to the following link.
Example:
To get the count of all the HTML elements
with the specified tag, specify the function as getHTMLElementCount("A","NONE","NONE")
which returns the count of all links in the HTML page.
To get the count of HTML elements with a
specified property name and value, specify the function as
getHTMLElementCount("input","type
","password") which returns the count of password input elements
in the HTML page.
Return Value:
Integer
Top
webGetText
Function
Description:
To get the body text between the given
prefix and suffix text from the HTML document.
How
to Define:
webGetText(prefixstr, suffixstr)
Example:
result =webGetText("text1", "text2")
displayMessage(result)
Return Value:
String.
Top
getLastError
Function
Description:
To retrieve the error (if any) thrown by
the last script statement that was executed before getLastError () was
invoked.
How
to Define:
result =getLastError()
Example:
result =getLastError()
displayMessage(result)
Return Values:
String Error message generated by the
previous.
Top
getPopUpText
Function
Description:
To read the text message displayed in the
popup.
How
to Define:
result =getPopUpText()
Example:
result =getPopUpText()
displayMessage(result)
Return Values:
String
Top
getUnExpectedPopUpTitle
Function
Description:
During playback, if any popup that was
not encountered during recording, appears then it is called unexpected
popup and you can read the title of the popup using this function.
How
to Define:
result =getUnExpectedPopUpTitle()
Example:
result =getUnExpectedPopUpTitle()
displayMessage(result)
Return Values:
String
Top
getCSVValueAt
Function
Description:
In Data Configuration tool, if a value in
the Comma Separated File (CSV) is identified based on Row and Column,
then this function is inserted in the script.
Note initCSV() must precede this line..
How
to Define:
initCSV("filename")
getCSVValueAt(rowindex,colindex)
Example:
initCSV("C:\a.csv")
for i in range (0,4):
for j in range (0,4):
result = getCSValueAt(i,j)
displayMessage(result)
Return Values:
Value
Top