Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to prove if an object exists?
#1
Solved: 11 Years, 3 Months, 1 Week ago
Hey guys,

i've had allready two ideas which didn't work yet.
I use QTP 9.2.

My problem:
I want to find at least one object with "innertext:="&Kriterium on a page. So i defined an object and use the following code to prove it. Unfortuneatly the Exist-function doesn't work in this context.

My code first try:
Code:
' define object
Set chKriterium = Description.Create
chKriterium("micclass").Value = "WebElement"
chKriterium("innertext").Value = Kriterium

Browser("P@W Report Viewer").Page("P@W Report Viewer").Frame("Report").ChildObjects(chKriterium).Exist

My code second try:
Code:
' define object
Set chKriterium = Description.Create
chKriterium("micclass").Value = "WebElement"
chKriterium("innertext").Value = Kriterium

Set EditCollection = Browser("P@W Report Viewer").Page("P@W Report Viewer").Frame("Report").ChildObjects(chKriterium)

If  EditCollection.Count > 0 Then
...

Someone can me explain, why it doesn't work and maybe how to solve my problem? Would be great Smile

lucster
Reply
#2
Solved: 11 Years, 3 Months, 1 Week ago
If Kriterium is not a variable,you missed quotes on Kriterium

Code:
chKriterium("innertext").Value = "Kriterium"

Otherwise code is fine
Reply
#3
Solved: 11 Years, 3 Months, 1 Week ago
Thought so as well but QTP throws a "Generall Error" in the "EditCollection"-line.

This line works:
Code:
If  Browser("P@W Report Viewer").Page("P@W Report Viewer").Frame("Report").WebElement("index:=0", "innertext:="&Kriterium).Exist(10) Then
...
Reply
#4
Solved: 11 Years, 3 Months, 1 Week ago
in that case it should work with dynamic DP as well if you add another property "index" and that timeout of 10 seconds
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Report Viewer showing hundreds of WebElement.Exists? themoon 1 2,320 03-09-2016, 02:43 PM
Last Post: vinod123
  How to check whether data exists in excel.. venkatesh9032 1 3,042 03-06-2014, 04:37 PM
Last Post: supputuri
  Object does not exists shwetasharma 4 9,074 03-01-2013, 01:05 PM
Last Post: shwetasharma
  Verifying the value exists and if not, wait up to 5min HeZma 3 4,028 02-25-2012, 12:21 PM
Last Post: rajpes
  Object not found in object repository Even it exists There Rohit 4 12,003 03-21-2011, 07:04 PM
Last Post: Rohit

Forum Jump:


Users browsing this thread: 1 Guest(s)