Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Number generator and verification problem
#4
Solved: 10 Years, 10 Months, 2 Weeks ago
I see the comparison code by you is fine, it requires a slight modification though.

Code:
If Browser("...").Page("...").WebEdit("...").GetROProperty("value")=CatEventCode Then

lets talk abt the above line.

CatEventCode : This the random number generated. This is in integer format.

Browser("...").Page("...").WebEdit("...").GetROProperty("value")= This will return the value in string format.

so if you directly compare the value, result will be fail. You need to do the typecasting.

correct code will be

Code:
strDisplayedValue=Browser("...").Page("...").WebEdit("...").GetROProperty("value") 'get the value
'convert it to integer for comparision
intConvertedValue=Cint(strDisplayedValue)
'now do the comparision
if intConvertedValue=CatEventCode Then
'Pass
Else
'Fail
End IF

Regards,
Ankesh
Reply


Messages In This Thread
RE: Random Number generator and verification problem - by Ankesh - 09-27-2012, 02:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create a random number starting with an alphabet QTPmate 4 3,908 07-31-2014, 09:29 AM
Last Post: QTPmate
  Random Values from Drop-Down profqa 5 5,765 12-06-2013, 09:01 AM
Last Post: basanth27
  Creating Random String SomeIntern 0 4,818 08-21-2013, 09:10 PM
Last Post: SomeIntern
  Export verification QAVA 1 2,504 11-05-2012, 10:25 AM
Last Post: sshukla12
  How to choose a random no from list alwarselvam 0 3,102 12-24-2011, 08:28 AM
Last Post: alwarselvam

Forum Jump:


Users browsing this thread: 1 Guest(s)