Posts: 8
Threads: 2
Joined: Jul 2009
Reputation:
0
07-20-2009, 02:27 PM
Hi, Is there a way we can write a common function for a sync operation... say we have Browser(x).Page(x).Obj1(x).sync and Browser(x).Page(x).Obj2(x).sync and so on.... Can we write one common statement and call the sync function by passing the object type. Appreciate all your help.. Thanks
Posts: 8
Threads: 2
Joined: Jul 2009
Reputation:
0
07-20-2009, 03:56 PM
QTP King,
Thanks for such a quick response... But sync is not my main objective... to write a generic function is what i'm breakin my head on.. well, lemme rephrase... say we have an imagebutton,link, webbutton... If i need to click on these, can i write a single click function which would work for all three( when i pass these values via a variable)... Aprreciate your help... thanks
Posts: 516
Threads: 17
Joined: Jul 2009
Reputation:
3
07-20-2009, 04:15 PM
Hi Martinangello,
yes we can write only one function which can work on different objects(Imagebuttons,webbuttons,links) based on the variables.
you can use "case" to handle this situation in while developing function.
Let me know if you wan me to devlop the function.
Thanks,
SUpputuri
Posts: 8
Threads: 2
Joined: Jul 2009
Reputation:
0
07-20-2009, 04:21 PM
QTP King,
Yes please... Or gimme some hints if u r too busy... thanks so much
Posts: 8
Threads: 2
Joined: Jul 2009
Reputation:
0
07-20-2009, 05:23 PM
What I have right now is a bit similar to this... but i'm tryin to write somethin more simpler/compact... well , lemme add more details... Browser(x).Page(y).Link(z).click... x,y,z are global variables and are read from an excel... every row in the excel has diff values for x,y,z... I use 'Execute' statement instead of the Call Function as the no of parameters to be passed varies from function to function... In the same way if i wanna hv a sync function (page sync alone wont work, as some objects load wel after the page has loaded) i'l hv several lines like
Browser(x).Page(y).Link(z).sync.......Browser(x).Page(y).Image(z).sync.....Browser(x).Page(y).weblist(z).click.... etc... Now can i handle these dynamically? like creating an object or something and just use obj.sync? Please advice... and sorry for dragging this thing....THANKS
Posts: 159
Threads: 0
Joined: Mar 2009
Reputation:
0
07-20-2009, 06:53 PM
One can also have different wait time defined in the environmental variable file and call it as appropriate.
Posts: 8
Threads: 2
Joined: Jul 2009
Reputation:
0
07-20-2009, 09:03 PM
Tarik,
Thanks... but instead of a wait function if i learn how to write a generic function, i'll be able to club so many things... like, i can use one click statement for link, button, image etc... one set statement for text and checkbox.. and so on... please help if u can... Thanks