Quality Testing

Quality is delighting customers

I am facing minor problems at runtime so plz execute this code and solve

c=window ("text:=Flight Reservation").wincomboBox("attached text:=Fly From:").GetItemsCount()
    
    e=window ("text:=Flight Reservation").wincomboBox("attached text:=Fly To:").GetItemsCount()
    
If c=e Then
        For i=0 to c-1
         d=window ("text:=Flight Reservation").wincomboBox("attached text:=Fly From:").GetItem(i)
    
        print "arr1 position--->" &i&"...."&"item-->"&d
 set str1=d
    msgbox str1
        
        set f=window ("text:=Flight Reservation").wincomboBox("attached text:=Fly To:").GetItem(i)
        print "arr2 position--->" &i&"...."&"item--->"&f
    
    str2=f
            m= StrComp(str1, str2, 1)
            msgbox m
            If m=0 Then
                msgbox"same items are listed on same location"
                else
                 msgbox"same items are not listed at same location"
            End If
    
        Next
else msgbox "no. of dropdown items are not same"
End If

Views: 532

Reply to This

Replies to This Discussion

Can you specify in detail what exact problem you are facing ?

As per my observation from your code, you have not Set str2

str2=f (your code)

Thanks 

Amit Nimje : Infocepts PVT LTD

Hi.

I corrected errors in ur code . Now it is working . Execute and check below code

c=window ("text:=Flight Reservation").wincomboBox("attached text:= Fly From:").GetItemsCount()

e=window ("text:=Flight Reservation").wincomboBox("attached text:=Fly To:").GetItemsCount()

If c=e Then
For i=0 to c-1
d=window ("text:=Flight Reservation").wincomboBox("attached text:= Fly From:").GetItem(i)

print "arr1 position--->" &i&"...."&"item-->"&d
str1=d


f=window ("text:=Flight Reservation").wincomboBox("attached text:=Fly To:").GetItem(i)
print "arr2 position--->" &i&"...."&"item--->"&f

str2=f
m= StrComp(str1, str2, 1)

If m=0 Then
msgbox"same items are listed on same location"
else
msgbox"same items are not listed at same location"
End If

Next
else msgbox "no. of dropdown items are not same"
End If

GetItem(i) function of WinCombobox Object returns simple value types

Well you have used "Set" keyword to assign a simple value to variables (str1 and f), where as "Set" keyword is used to assign a reference (memory location address) of object in memory.

please go through this for better understanding. http://www.tizag.com/vbscriptTutorial/vbscriptvariables.php

Hi,

If you have a possibility to use C# program with interpreter (eg Visual Studio) you can make .dll class and call it from QTP.

http://www.solutionmaniacs.com/blog/2012/5/29/qtp-calling-c-dll-in-...

var arr1 = new Listfont color="blue">string> { "a""b""c""d" };
var arr2 = new Listfont color="blue">string> { "a""c""x" };
 
//var taulukko3 = taulukko1 - taulukko2; //b, d;
var arr3 = taulukko1.FindAll(x => !arr2.Contains(x));
var arr4 = taulukko2.FindAll(x => !arr1.Contains(x));
arr3.AddRange(arr4);
t T

Sorry there is a typo:) 

Should be next:

var arr3 = arr1.FindAll(x => !arr2.Contains(x));
var arr4 = arr2.FindAll(x => !arr1.Contains(x));
t T

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service