In one of the test case being executed from QTP, we have to choose a value from combo box in the web page. Now, the dataset present in the test case have the same items which are present in combo-box but in different format i.e if the value present in dataset is “Double AC”, value present in combo-box is “Double Ac” and similar for most of the values.
So my query is can QTP make a insensitive search while calling weblist.Select OR weblist.ExtendSelect methods. Can this be done as presently QTP just matches the datavalue from the items present in combo-box.
Thanks in Advance [img]/images/graemlins/smile.gif[/img]
cnt = b.p.weblist.getroproperty("items count")
For i = 1 to cnt
strappcomboval = b.p.weblist.getroproperty("selection")
if lcase(strDatasetval) = lcase(strappcomboval) then
This should do it.
objWebList - weblist object
strItem - item that you want to select
intExatMatch - True/False if you want exact match. in your case you need False
<font class="small">Code:</font><hr /><pre>
Function fSelectWebListItem(ByRef objWebList, ByVal strItem, ByVal intExatMatch)
Dim strAllItems 'Holds all Items in a combo box
Dim aryComboList 'Puts all the items in an array
Dim intItem 'get the item number
Dim i 'Counter for FOR loop
For i = 0 to UBound(aryComboList)
If intExatMatch Then
If StrComp(aryComboList(i),strItem,1) = 0 Then Exit For 'Compare two values
If InStr(1,aryComboList(i),strItem,1) > 0 Then Exit For
If i <= UBound(aryComboList) Then
fSelectWebListItem = True
fSelectWebListItem = False