SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Exist

  1. #1
    Member
    Join Date
    May 2007
    Posts
    75
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Exist

    Hi,

    Here is the code that I had used:

    Browser().Page().WebButton().Exist(1)

    In the QTP tutorial it is stated that if a timeout value is specified, QuickTest waits until it finds the object or until the timeout is reached.

    Reading this guideline, I thought that QTP will wait only for one second and then go to the next step. But QTP is waiting for much much longer time and hence taking much longer time to run the script.

    How can we instruct QTP to wait only for stipulated amount of time and if object is not found then go to the next step?

    Please advise.
    Thanks!

  2. #2
    Super Member FredMan's Avatar
    Join Date
    Oct 2007
    Location
    Lenexa, Kansas
    Posts
    1,218
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Exist

    I have only used it in an if statement and it always worked for me.

    If Browser().Page().WebButton().Exist(1) Then

    MsgBox "The button exists."

    End If
    Onward thru the fog...

  3. #3
    Member
    Join Date
    May 2007
    Posts
    75
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Exist

    Thanks!

    Well, it takes about 10 seconds for the next step to be executed even though I specify Exist(1). I am not sure if any settings need to be modified.

  4. #4
    Senior Member
    Join Date
    Aug 2004
    Location
    Bloomington, IL
    Posts
    300
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Exist

    post your code here..

    Exist(1) will wait till one second, and continues with the next step.

    Thanks,
    Ashok

  5. #5
    Member
    Join Date
    May 2007
    Posts
    75
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Exist


    Here's the code. Let me explain you the scenario. I have parameterized a field. Certain values will display two screens (successively) with the webbutton "OK" which needs to be invoked. Certain values display only one screen with the webbuton "OK".

    -----------------------------------

    .....
    .....
    Browser("title:=Job Data").Page("title:=Job Data").WebButton("name:=OK").Click


    If Browser("title:=Job Data").Page("title:=Job Data").WebButton("name:=OK").Exist(1) Then


    Browser("title:=Job Data").Page("title:=Job Data").WebButton("name:=OK").Click

    Else
    Browser("title:=Job Data").Page("title:=Job Data").Link("name:=Job Data").Click

    End If

    -------------------

    I even tried removing the Else part of the code (just tried trial and error method). It did not work either.

    Thanks!

  6. #6
    Advanced Member
    Join Date
    Sep 2007
    Location
    Chennai, Tamil nadu, India
    Posts
    999
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    i have never seen bugs sleeping

  7. #7
    Junior Member
    Join Date
    Jul 2006
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Exist

    Dear Prince3105
    Your links bring me to two no-relevant threads

  8. #8
    Senior Member
    Join Date
    Jan 2000
    Location
    USA, CA
    Posts
    1,998
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Exist

    >But QTP is waiting for much much longer time and hence taking much longer time to run the script.
    On Exist(1) QTP waits
    default Browser Navigation timeout + 1 sec.

    >How can we instruct QTP to wait only for stipulated amount of time and if object is not found then go to the next step?
    You can adjust this setting: File --> Test Settings --> Web

    Janna

  9. #9
    Junior Member
    Join Date
    Jul 2006
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Exist

    I also encounter this problem.

    I have set the value of option "Object Synchronization timeout" to 0 second and disabled the "smart identification" option.

    But the Exist(0) still wait 5 seconds. I have searched all the settings of QTP and can't find which command it to wait 5 s.

    I found this:
    If the parent is not exist, the Exist(0) will not work. Otherwise, it work.

  10. #10
    Junior Member
    Join Date
    Jul 2006
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Exist

    Following is my code:

    MercuryTimers("counter").Start
    If Browser("PEM").Exist(0) Then
    msgbox "Exist"
    End If
    MercuryTimers("counter").Stop
    Reporter.ReportEvent micDone, "Spend time: ", MercuryTimers("counter").ElapsedTime

    When there is not exist the Browser("PEM"), QTP will wait 5 seconds.

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 8.82%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:26 PM.

Copyright BetaSoft Inc.