For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
Course Name Date Time Duration Type Location
An important update from QtpSudhakar. I stopped giving classroom training in MindQ Systems. I have bigger plans and I want to put an end to regular classroom training because very less people are practicing. From now onwards every session of mine is going to have explanation and practice. Everyone should practice in presence of mine and should go out of classroom with practical knowledge. So I started my own institute AnyTechLabs in Madhapur. Please reach out to +91-8328152362 for course details. Visit AnyTechLabs.com for address details.
Selenium + Cucumber 24th October 7.30 AM IST to 9.00 AM IST 45 Days WeekDay Online

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Wednesday, March 12, 2014

Select webtable checkbox from dynamically changing table rows

How can you select check box with id “4” in the following web table where the table rows are changing dynamically?
To select checkbox based on id number, we have to follow below steps
Step#1: Identify the row and column numbers of “ID” value in the table using Getcelldata method
Step#2: Based on identified values of step#1, The previous cell of “ID” value is checkbox cell. Apply ChildItem Method to get checkbox object
Step#3: Select checkbox.
Function SelectCheckboxById(oWebTableObject,IdNo,ColumnId)  
'Diclare Variables  
Dim tblRowCount, tblRowIndex, tblCellId  
Dim tblWebCheckBox  
'Get the Row Count of the Webtable  
For tblRowIndex = 1 to tblRowCount  
 'Get cell data of each row  
 tblCellId = oWebTableObject.GetCellData(tblRowIndex,ColumnId)  
 'Compare cell data of each row with the input Id number  
 If tblCellId = IdNo  Then  
  ' Get Checkbox object from the identified column  
  Set tblWebCheckBox = oWebTableObject.ChildItem(tblRowIndex,ColumnId-1, "WebCheckBox",0)  
  ' Set Checkbox on  
  tblWebCheckBox.set "ON"  
  Exit Function  
 End If  
End Function  

'Store WebTable Object in to a variable
Set aWebTableObject=Browser("Browser").Page("Page").WebTable("Catalog")  

'Calling function  
'4 is the id value, 2 is column id in which id value is available


No comments :

Post a Comment