Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question / Object doesn't support this property (Exist)
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi folks,

I'm a QTP beginner (surprise!). I have a trial version of QTP 11 (build 1018), and am playing around to see if it might be a valuable addition for our company. (Incidentally, the "Posting Guidelines" hyperlink in the "please read this" thread is dead, so I'm winging it here as best I can. I have gone through the QTP tutorial, and found it very helpful.)

So, I figured I would try to build a very simple test based on the login screen of our .NET windows application. It's a very simple screen with some labels, a password field, and OK/Cancel buttons. I have the .NET, Web, and WPF add-ins activated, although I confess I'm not a developer and am not 100% certain I'm doing this right. I'm running on Win 7 Pro, SP 1.

I set up a test, and used "Navigate and Learn" to create the object repository. It successfully found the objects on the screen. In my test, I tried to simply test whether or not a given label exists on the screen. I did this by selecting the "Project Code" label item and the "Exist" operation from the Keyword view. The Expert View shows this:
Code:
SwfWindow("MyScreen").SwfLabel("Project Code:").Exist

However, when I run the test, it immediately says, "Object doesn't support this property or method: 'SwfWindow(...).SwfLabel(...).Exist'".

When this didn't work, I tried a Click operation on one of the buttons, and that seemed to work. I've tried Googling this a bit, but haven't come across anything obvious. I was hoping that I'd have luck getting this simple test done, but so far, no love.

Can anyone point me in the right direction? I'm happy to answer any questions I can...

Thanks!

~Steve
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
The line
SwfWindow("MyScreen").SwfLabel("Project Code:").Exist
returns a boolean value i.e.,"true" or "false" .Hence we are supposed to either assign the above statement to a variable or use it in a conditional statement.The two codes shown below demonstrates the usage
Code:
strChk=SwfWindow("MyScreen").SwfLabel("Project Code:").Exist
msgbox strChk
or
Code:
If SwfWindow("MyScreen").SwfLabel("Project Code:").Exist  Then
     msgbox "item Exists"
End If
Hope this clarifies your query
Regards,
Ravi
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Thanks, that helps! Although, I must confess, I've been playing around with QTP more using the GUI than coding (I'm not a coder).

Still, I was able to make some progress...

Thanks!

~Steve
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  File Chooser on Chrome doesn't work - UFT 15.0.1 Nenna Rosa 1 3,666 10-31-2020, 01:16 PM
Last Post: Ankur
  Exist and Visible Are True When Objects Aren't There - Is there A Better Way? zunebuggy 3 3,146 04-24-2018, 02:12 PM
Last Post: Ankur
  Time Delay issue with Exist mv8167 11 24,814 06-19-2017, 02:56 PM
Last Post: grosorg
  [UFT] Change property of object (WpfButton) robertosalemi 2 2,626 11-22-2016, 12:43 PM
Last Post: Ankur
  Uft 12 - Identification of Google Chrome Object's Property value as plain text teja2730 0 2,583 02-02-2015, 05:22 PM
Last Post: teja2730

Forum Jump:


Users browsing this thread: 2 Guest(s)