Description : HTML
Table functions are used to retrieve properties / data from a HTML
Table in the web page to use it / compare it inside the script.
Where the HTML Table Functions can be
used ?
Following is the scenario
where HTML Table Functions can be used,
- To get the number of rows / columns in a HTML table.
- To get all the column values of the HTML table.
- To get particular cell value.
How to insert HTML Table Functions in
the script ?
HTML Table functions should be inserted while recording the
script. During recording to insert HTML Table Function follow the
below steps :
- Click the "Insert Built-in Function" link available above the
script editor
- In the Function Category combo select "HTML Table Functions" from
the list.
- In the Functions Combo select the appropriate HTML table
function and click on "Click to Proceed" link.
- Select the appropriate Table from the web page from which the
value needs to be retreived.
- This will list all the identification details of the table with
the row & column index of the table where you clicked.
- After providing the above details click on "Paste" to add the get
function in to the script.
Following are the various HTML Table functions available in QEngine :
getAllHTMLTableCells
Function
Description:
To retrieve all the table cell values for
the selected table.
How
to Define:
getAllHTMLTableCells("Element ID")
Element
ID = Generated by QEngine
Example:
result=getAllHTMLTableCells(""Name_2")
You can verify the output of the function
by iterating through the returned object.
E.g
for i in range(0,len(result)):
for j in range(0,len(result[i])):
displayMessage(str(result[i][j]))
Return Values:
Two dimensional array object containing
the values of all the table cells
Top
getCellHTML
Function
Description:
To fetch the value of the innerHTML
property of a table cell with the specified table id, row index and
column index.
How
to Define:
getCellHTML("<table
id>","<row_index>","<column_index>")
Element
ID = Generated by QEngine
Example:
result=getCellHTML("Table_2", 1, 2)
This will fetch the innerHTML value of
the table cell in 1st row and 2nd column and whose id is Table_2.
Return Values:
String
Top
getlHTMLTableHTML
Function
Description:
To fetch the value of the innerHTML
property of a table with the specified table id.
How
to Define:
getHTMLTableHTML("<table_id>")
Example:
result=getHTMLTableHTML("Table_2")
This will fetch the innerHTML value of
the table cell whose id is Table_2.
Return Values:
String
Top
getHTMLTableColumnValues
Function
Description:
To retrieve the table column values for
the given column index
How
to Define:
getHTMLTableColumnValues("Element
ID","Column Index")
Element
ID = Generated by QEngine.
Column
Index = Index of the column to be retrieved.
Example:
E.g.
result =
getHTMLTableColumnValues("S.No_1",2)
for i in range(0,len(result)):
displayMessage(st(result[i]))
Return Values:
Array object containing the column values
for the given column index
Top
getHTMLTableRowCount
Function
Description:
To retrieve the number of the rows from
the selected table.
How
to Define:
result=getHTMLTableRowCount("Object ID")
Object
ID =Generated by QEngine.
Example:
result=getHTMLTableRowCount("Employee N")
displayMessage(result)
Return Values:
Integer
Top
getHTMLTableColumnCount
Function
Description:
To retrieve the number of the columns
from the selected table
How
to Define:
result=getHTMLTableColumnCount("Object ID")
Object
ID =Generated by QEngine.
Example:
result=getHTMLTableColumnCount("Employee N")
displayMessage(result)
Return Values:
Integer
Top
getCellElementProperty
Function
Description:
To get the property value of a HTML
Element inside a HTML Table Cell Element.
How
to Define:
getCellElementProperty(tableid,rowindex,
colindex, property needed, [tag], [propertyname], [propertyvalue],
[index])
Mandatory
Parameters:
1.
tableid = Generated by QEngine.
2.
rowindex = row no in the table.
3.
colindex = column no in the table.
4.
property needed = property for which the value need to be fetched.
Optional
Parameters:
1.
tag = tagname of the elements.
2.
propertyname = property to be matched.
3.
propertyvalue = property value to be matched.
4.
index = occurence of the elements.
Example:
getCellElementProperty("Employee N",1, 3,
"value")
Return Values:
String
Top
fireEventOnCellElement
Function
Description:
To invoke or fire the specified event for
the given HTML Table Cell element.
How
to Define:
fireEventOnCellElement(tableid,rowindex,
colindex, actionname, [actionvalue], [tag], [propertyname],
[propertyvalue], [index])
Mandatory
Parameters :
1.
tableid = Generated by QEngine.
2.
rowindex = row no in the table.
3.
colindex = column no in the table.
4.
actionname = action or the event to be fired.
(click,
doubleclick, mouseover, select, settext, etc.)
Optional
parameters :
1.
actionvalue = Required only if actionname is settext or selected. For
other actionnames, actionvalue is NONE.
2.
tag = tagname of the element. Default NONE.
3.
propertyname = specify the property name adjacent to the exact cell
element in which the specified event has to be fired. Default NONE
4.
propertyvalue = specify the property value for the property name
adjacent to the exact cell element in which the specified event has to
be fired. Default NONE
5.
index = occurence of the cell element should start with 1. Default
value 1.
Example:
fireEventOnCellElement("TableID",2,3,"click","","INPUT","id","buttonid",1)
The above statement in the script will
click a input button whose id is "buttonid" which is present in the 2nd
row, 3rd column of the table where "TableID" is the ID generated by
QEngine.
Return Values:
-NA-
Top
doesColumnContain
Function
Description:
Checks if the selected HTML Table cell
value is found in the specified column of the
resultset after query execution.
How
to Define:
doesColumnContain("Element ID","HTML
Table Row Index", "HTML Table Column Index", "String sql query", "DB
Column Index" or "DB Column Name")
Example:
when ColumnName is selected
initDB("1.1")
doesColumnContain("S.No",3,4,"select
name from emptable","name")
when ColumnIndex is selected
initDB("1.1")
doesColumnContain("S.No",10,4,"select
name from emptable",1)
Return Values:
0 for Success
1 for Failure
Top
getCellValueAt()
Function
Description:
To retrieve the value of the specified
cell from the table.
How
to Define:
result=getCellValueAt("Object ID", row
index, column index)
Mandatory
Parameters :
1.
tableid = Generated by QEngine.
2.
rowindex = row no in the table.
3.
colindex = column no in the table
Example:
result=getCellValueAt("Employee_N",2,2)
displayMessage(result)
Note: If the
specified cell has an HTML element then QEngine returns the value of
the HTML element in the cell. For example, if the cell has a HTML
TextField element then returns the value of the text field. Similarly,
if an image element exists in the cell then returns the src value of
the image element in the cell.
Return Values:
Value of the specified cell
Top