Highlighted
Absent Member.. Absent Member..
Absent Member..
1382 views

HP UFT VBSCRIPT SET METHOD

Jump to solution

Below is a snippet from the UFT help, and it is describing the SET method. This code of VBScript uses the SET method to input a hard-coded value, mercury. I would like to input the value contained by a variable.

1) Can this be done using the SET method?

2) Is there a better way to input the variable's value?

I do not want to input a hard-coded value. I want to input the value contained by a  variable.

 

Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "mercury"

0 Likes
1 Solution

Accepted Solutions
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Yes - simply pass in your variable to the Set method.  i.e. Browser().Page().WebEdit().Set MyVar

Is there a "better" way?  This would depend on if the desired behavior is performed by the .Set method for that particular object.

View solution in original post

2 Replies
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Yes - simply pass in your variable to the Set method.  i.e. Browser().Page().WebEdit().Set MyVar

Is there a "better" way?  This would depend on if the desired behavior is performed by the .Set method for that particular object.

View solution in original post

Highlighted
Absent Member.. Absent Member..
Absent Member..

Not sure what I did incorrectly. Previously, I tried passing the variable without the surrounding double quotes and it failed. Now, after reading your post, I tried it again and it worked. It repeatedly worked so again, not sure where the obvious mistake was on my part. Thanks for posting and confirming what I originally thought was correct.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.