Problem with function call - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Problem with function call (/Thread-Problem-with-function-call) |
Problem with function call - vijay44 - 01-27-2010 Hi, I wanted to pass the name of the webbutton from the datasheet. for this reason iam using the below code: Code: Function ClickWebButton(strName) and i am calling the above function Call ClickWebButton(Save)-->Save is the name of the Webbutton used as the strName. The above code is not working Any help will be really appreciated. Regards; Vijay RE: Problem with function call - Saket - 01-27-2010 set one more property in your description object Code: WbButton("name").Value = strName let me know how it goes. RE: Problem with function call - Anshoo Arora - 01-28-2010 Hi Vijay, When you attempt to create an object collection with the index as one of the defining properties, you're limiting the size of the object collection as well as stating that you're certain of the object to be retrieved through the use of the ordinal identifier. If you remove the below line of code, and create your function, you should see better results. Code: WbButton("Index").Value = 1 Secondly, you can improve performance in your code if you use the property within the description object instead of looping through all items and finding the button with the correct name. Since your code clicks the first found WebButton, wouldn't it be better to limit your code to the following: Code: Set WbButton = Description.Create() Lastly, the below lines of code: Code: If WBname = strName Then should be: Code: If WBname = strName Then I hope this helps. Correction in my last statement: Lastly, the below lines of code: Code: If WBname = strName Then should be: Code: If WBname = strName Then |