Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can class be a variable in DP
#1
Not Solved
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
oDesc("micclass")="link"
oDesc("name") = "click here"
Browser(oBrowser).Page(oPage).Link(oDesc).getROProperty("outerhtml")

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"
vname = "click here"
vproperty = "outerhtml"
set oDesc = Description.Create
oDesc("micclass")=vclass
oDesc("name") = vname

Browser(oBrowser).Page(oPage).VCLASS(oDesc).getROProperty(vproperty)

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.
Reply
#2
Not Solved
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  DP Encapsulation Within Class Object TheGlovner 2 1,777 10-12-2018, 02:11 PM
Last Post: TheGlovner
  Dynamic obj rep - get text in the class (html) marcio cravo moreira 0 2,123 05-26-2015, 06:58 PM
Last Post: marcio cravo moreira
Sad QTP Script | how to get object of some open window just using its class type,Java sophia.sabir 1 8,865 08-07-2013, 01:26 PM
Last Post: anil2u
  Use of Class Concept in QTP sshukla12 6 15,080 12-23-2011, 03:44 PM
Last Post: sshukla12
  how can I store a string with variable in it, in another variable? reejais 4 4,600 11-11-2010, 11:46 PM
Last Post: smeepaga

Forum Jump:


Users browsing this thread: 1 Guest(s)