Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Verify a Non Existing Object
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

I have a Menu which is displayed when i hover the mouse on it.
It displays a list of menu options depending on the user permissions.

My scenario is to check if a particular menu option is not displayed for a user.
I'm trying to use the below line of code to check the option is not present for the user.

Code:
Browser("IE").Page("Page").Link("ABC").Exist

But it throws an error message since the object was not found in the object repository.

How do i handle this scenario?
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Get all the links displayed in an array and compare the text property of the required link with the links fetched.You may use child objects method to get all the links.
for ex:
Code:
set allLinks=Browser().Page().childobjects(<Linktype>)
for i=0 to allLinks.length-1

If allLinks(i).getRoProperty("innertext")="ABC" then
msgbox "Link Exists"
Else
msgbox "link doesn't exist"
End If
Next

Regards,
Ravi
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi

I had faced a similiar issue. Usually such drop-downs are identified as webtable by qtp. check for that. If its a webtable its further easy for u to get the child objects from the webtable using what ravi suggested

Code:
like Browser(Browser).Page(Page).webtable(webtable).childObjects

Anil
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [UFT] [WPF] Verify if the cell contains an image robertosalemi 0 1,896 10-25-2016, 06:57 PM
Last Post: robertosalemi
  Need to verify the drop down values based on condition santhoshmscsoftware 1 2,906 05-04-2016, 11:28 PM
Last Post: supputuri
  verify that parent properties match object currently displayed in your application. sona 0 3,133 02-21-2016, 12:00 PM
Last Post: sona
Exclamation How to verify whether pdf is completely loaded or not in webpage nmakkena 1 2,672 08-27-2014, 04:09 PM
Last Post: vinod123
  Not able to edit existing scripts in QTP 11 prit deo 1 4,046 02-14-2014, 11:20 PM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)