Important Topics & Useful Scripts on QTP. Ask your QTP related questions at this id - asrajaputra@gmail.com
Sunday, July 5, 2009
How to Click on Dinamic Links
Here is the script to click on the dynamic Links in table. Even though if any link are dynamic we can get control on the links by using index.
'*******************************************************************
Set TblObj=Browser( BrowserProp) .Page(PageProp) .WebTable( TableProp)
r_Count=TblObj. RowCount
For r=1 to r_Count
c_Count=TblObj. ColumnCount( r)
For c=1 to c_Count
chItems_Count= TblObj.ChildItem Count(r,c, "Link")
For ItemIndex=0 to chItems_Count- 1
Set ch_Item=TblObj. ChildItem( r,c,"Link" ,ItemIndex)
Print ch_Item.object. title
ch_Item.click
' Specify the required operations after clicking on link
' Make sure that again you should navigate to the same page to get other links tooltip
'Or to click on other Links
Next
Next
Next
'**********************************************************************
'*******************************************************************
Set TblObj=Browser( BrowserProp) .Page(PageProp) .WebTable( TableProp)
r_Count=TblObj. RowCount
For r=1 to r_Count
c_Count=TblObj. ColumnCount( r)
For c=1 to c_Count
chItems_Count= TblObj.ChildItem Count(r,c, "Link")
For ItemIndex=0 to chItems_Count- 1
Set ch_Item=TblObj. ChildItem( r,c,"Link" ,ItemIndex)
Print ch_Item.object. title
ch_Item.click
' Specify the required operations after clicking on link
' Make sure that again you should navigate to the same page to get other links tooltip
'Or to click on other Links
Next
Next
Next
'**********************************************************************