Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search function in repository
#1
Solved: 11 Years, 3 Months, 1 Week ago
With QTP, the function "Exist" runs only if an object is in the repository.

for example, I have a WebButton named "login" in repository. If I use the Exist function, result is "true" if the object is on screen or "false" if the object is not present on screen.
But if the Webbutton was never identified in repository, the exist function will return an error "object not find in repository"!

I need to create a function to analyse if an object exist in repository.
With this function, i will be able to know if an object exist and after that, I can try to execute an operation.

For example, I developed a ButtonClick function in Web environment. classicaly the command will be

Code:
Function ButtonClick (XXX,YYY,ZZZ)
    Browser("XXX").Page("YYY").WebButton("ZZZ").Click
End Function

But It should be possible that my object is not a WebButton but an image.
In this case the function must be :

Code:
Function ButtonClick (XXX,YYY,ZZZ)
    Browser("XXX").Page("YYY").Image("ZZZ").Click
End Function

How Can I combine this two function in one?
I try this:

Code:
Function ButtonClick (XXX,YYY,ZZZ)
    if  Browser("XXX").Page("YYY").WebButton("ZZZ").exist = true then
         Browser("XXX").Page("YYY").WebButton("ZZZ")
    else
        Browser("XXX").Page("YYY").Image("ZZZ").Click
    end if
End Function

In case of Image exist in repository but not the webbutton with this name, the exist function return error and QTP stop. So I need to know if an object exist in repository, check his different classes and execute action based on different classes.

Someone can help me with this issue?
Reply


Messages In This Thread
Search function in repository - by gbartokai - 04-16-2009, 03:28 PM
RE: Search function in repository - by Hema - 07-08-2009, 05:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  CyberArk CorePAS REST API to search for accounts pramod 0 827 06-29-2023, 03:11 PM
Last Post: pramod
  Calling a function in a Test Script from a function library anupam4j 3 6,092 06-26-2015, 12:31 AM
Last Post: babu123
  Search All Test scripts For a Function? AndyBSG 1 2,706 02-19-2015, 04:15 AM
Last Post: supputuri
  Search for a string in all the files under all subdirectory Mahesh27 1 2,178 07-03-2013, 03:24 PM
Last Post: Sathiya
  Testing Search box kriday 1 2,512 06-26-2013, 08:51 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)