Interview Questions

WinRunner: How to read dynamic names of html_link

Mercury WinRunner FAQ


(Continued from previous question...)

WinRunner: How to read dynamic names of html_link


Answer1:
Use the following steps:
1) Using the Function, web_tbl_get_cell_data read the link.
2) use GUI_add function to add to the Map editor.
3) use GUI_save function to save the same link.
4) Now, web_link_click() and pass the variable that you got in step

Answer2:
Can try this method. It will reduce the complexity and there is no need to update the GUI Map File. Use web_tbl_get_cell_data() function to get the Description of the link and use the variable name in web_link_click() function.
web_tbl_get_cell_data("Tablename","#Rowno","#columnnumber",0,cell_value,cell_val\ ue_len);
web_link_click(cell_value);

Answer3:
1.get number of row in your table: tbl_get_rows_count ("tableName",rows);
2.write a for loop: for(i=0;i<=row;i++)
3.get text of specified cell with column and row:tbl_get_cell_data ("Name","#"&i,column,var1);
4.compare with the if condition
5.if true : make any flage and take row number in variable m
6.now end the loop and write
tbl_set_selected_cell ( "tableName", "#"& m,column);
type ("<kTab><t2><kReturn>");
Example:
tbl_get_cols_count("Name",cols);
tbl_get_rows_count("Name",rows);
for(i=2;i<=rows;i++)
{
for(j=1;j<=cols;j++)
{
tbl_get_cell_data("Name","#"&i,"#"&j,var1);
if(var1 == Supplier)
{
m=i;
}
}
}
tbl_set_selected_cell ( "Name", "#"&m,"#"&j type ("<kTab><t2><kReturn>");

(Continued on next question...)

Other Interview Questions