Micro Focus QTP (UFT) Forums
Using Variable in Checkpoint - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Using Variable in Checkpoint (/Thread-Using-Variable-in-Checkpoint)



Using Variable in Checkpoint - kapsig431 - 03-30-2012

I've read several form threads hoping to find an answer to this question and so far have not.

What I'm doing is simple. I have a WebEdit object and in this object, I'm inserting a string concatenated with a variable. It looks like this:

Code:
Browser("salesforce.com - Unlimited").Page("Campaign Edit: New Campaign").WebEdit("Campaign - Campaign Name").Set "Everett Auto Sales" & varDateTime

Once this web page saves, I want to check a WebElement to ensure my object saved the string and variable combination. For example, this is a "name" field and I'm entering something like "Everett Auto Sales3/29/2012 10:15 AM". Once I click the "save" button, I want to check to ensure that a particular Web Element on the subsequent page captured the "name" correctly.

I've looked into creating an environmental variable and calling that into a standard checkpoint parameter, however, based on the concatenation of a string and variable, I just can't get it to work. So, I started playing around with an if/else statement thinking that may be the answer. I tried something like this:

Code:
If Browser("salesforce.com - Unlimited").Page("Campaign: Everett Auto").WebElement("Everett Auto Sales")= "Everett Auto Sales" & varDateTime Then
    micPass
Else
    micFail
End If

Unfortunately, I'm not as skilled as I'd like to be in VB and don't know were to go from here. I'm getting an "Object doesn't support this property or method" error. Even after I get passed that, I'm not sure if the micPass/micFail will even work. Can anyone please provide me some direction? I would assume that putting checkpoints on variables is commonplace, but I just can't seem to get this to work.

Thanks to anyone who can give me direction.