can class be a variable in DP - 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: can class be a variable in DP (/Thread-can-class-be-a-variable-in-DP) |
can class be a variable in DP - wyrdo - 03-06-2013 I'm wondering if it's possible to address a page element micclass using a variable. For instance, to get a property on a link i can say Code: set oDesc = Description.Create or in my case, the micclass and property to get come in a variable. So i'm looking for an address that is similar to the above, but allows me to use the var value for the .Link Code: vclass = "link" I notice that there are multiple ways to address a page object, but so far haven't been able to use any of them. Can anybody make a suggestion? I know i can create a switch based on all possible values for micclass but i'd like to do it in as few lines of code as possible, and a giant switch with 10 cases is a lot of lines of code. Plus it's not expandable if ever a class is added or removed. Thanks. RE: can class be a variable in DP - anil2u - 08-07-2013 Hi, I don't think you can do that.. there is a way of registering user-defined functions which do what you want using 'RegisterUserFunc' but for that again you have to write a function and it will end up with the same code. Cheers Anil |