Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Time Delay issue with Exist
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
This has bothered me more some time but now I hope to learn and understand why?

I use Exist(#) with my If and other statements. Not always, but when I set Exist to (0) or (1) ... etc is still takes 10, 20 plus seconds before moving on.

I thought Exist(1) took 1 second to search, then moving on. What/where might there be a setting that is keeping my Exist looking for past my instuctions of 0, 1 sec ... etc?

C an antyone help explain what is going on?

thxx
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
When we are using .Exist(#) then qtp waits until it finds the object or until the timeout is reached, that's why it is taking 10,20 plus seconds before moving on, These 10, 20 plus seconds depends on the value u specified for Object Synchronization Timeout under File->Setting->Run.

Hope this will help u.

Regards,
Sankalp
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
SanKalp,

I thought if I let Exist(#) with time #, QTP skip the synchronization under File->Setting->Run and uses # to determine how long to look. If no time # is given, then QTP uses the synchronization under File->Setting->Run and continues.

So, if i use Exist(0), I would still wait up to 20 seconds if obj synchronization timeout (File->Setting->Run) is set to 20 seconds?

Is it save to set the the obj synchronization timeout to 1 sec?

My current concern is that QTP is running to slow when an If an Exist is
False. So I placed Exist(0) or Exist(1) but QTP takes a long time to tell that no obj exists. But when Exist is True, QTP will pass to quickly and run to fast. Wherer I need to wait, QTP might run to fasst and miss what I need to find.

Any thoughts?

L
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Make the Global synchronization point to 0 sec under Run--> Settings.
Thanks,
SUpputuri
Reply
#5
Solved: 11 Years, 3 Months, 4 Weeks ago
thx

I tried this, and my script started crashing in places it had been waiting before.

I just thought the Exist statement over road the global sync that you mentioned. I thought that if I used Exist(1) it would wait 1 sec if nothing was found prior to 1 sec the code would continue. But it seems Exist adds time to the global sync value?
Reply
#6
Solved: 11 Years, 3 Months, 4 Weeks ago
@ Lorena: There are 3 cases.
Case 1: Exit----> without any timeout.
In this case qtp will search the object according to the Object syncronization time out.

Case 2: Exit(0)--->time out specified as 0
In this case QTP returns the True or False value immediately.

Case 3: Exit (#)---> time out specified as some value.
In this case QTP waits until it finds the object or until the timeout is reached.

I tried all the three case at my end and it was working very fine.
Below is the script that i used for my internal portal.

Code:
MsgBox("Welcome")
If Browser("My News").Page("My Applications").Link("eManager").Exist(0) Then
    MsgBox("false")
    else
    MsgBox("true")
End If
Browser("My News").Page("My News").Link("My applications").Click
Browser("My News").Page("My Applications").Link("eManager").Click

Here I am looking for a link which is present on some another page.
When I am using Exit(0) its immediately giving me msgbox as True.
and when I am using Exit alone it takes time according to the Object syncronization value.

Please try it again and let me know.

Regards,
Sankalp
Reply
#7
Solved: 11 Years, 3 Months, 4 Weeks ago
Sankalp,

(I will assume that you meant Exist and not Exit)

This is how I always assumed the Exist code to work. Thx for reconfirming it for me.

But for whatever reason, it seems that in a false statement, thed Exist(5) will wait up to 20 plus seconds. In reality it should wait 0>5 seconds and continue if found betweeen 0>5 and if false at =5 the Exist is false and the code continues. So, if set my obj syc timeout to 20 seconds, my Exist(5) will wait closser to 25 second than top 5 seconds

Maybe iot is a QTP issue or I am not sure why my Exist cointinues to wait after 5 seconds. It has been a nuesance for a while now. Not everywhere but ussually in the same places.

I did change my obj sync timeout from 20 to 10 seconds.

Thx so much for chatting
Reply
#8
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,

If u refer the help file of QTP you will find the details , what u are suggesting is some thing that Exist(#) function should do but according to the functionality provided by this function is bit different.

What u are suggesting should be the functionality but as per my understanding it is not so.

Regards,
Sankalp
Reply
#9
Solved: 11 Years, 3 Months, 4 Weeks ago
Sankalp,

Yup, ok... I thought i might be reading the functionality wrong or was not using it correctly.

Thx for your time.
Reply
#10
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi Lorena, i also faced this issue yesterday.

when i was trying to analyse why ...this is what i have found...
Do note that it is nothing to do with obj sync timeout property.


Code:
Msgbox Browser("CreationTime:=0").Exist(0)

No of browsers open = 0
Here i was expecting to timeout in 0 seconds to return false ..but it took around 5 seconds.

Code:
Msgbox Browser("CreationTime:=0").Exist(5)

No of browsers open = 0
Here i was expecting to timeout in 5 seconds to return false ..but it took around 10 seconds. (adds approx 5 seconds)

when u have a browser open, it returns true @ once w/o any wait.

Instead of creation, i also tried with other properties, the behavior is same.

Code:
Msgbox Browser("CreationTime:=0").Page("micclass:=Page").WebEdit("name:=userid").Exist(0)

No of browser open = 1 or > 1
no webedit in that name.
it reurns false w/o any wait.

So, Exist gets timeout as expected only atleast one browser is open. if not, it takes additional time...i dont know where 5 seconds comes from...




Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  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
  Performance Issues Using '.Exist' AndyBSG 2 3,501 12-12-2014, 03:24 PM
Last Post: AndyBSG
  datatable column exist diya 3 12,546 12-11-2012, 11:24 AM
Last Post: elango87
  Check if exist not selected radiobutton sedin 6 7,770 09-12-2012, 12:55 PM
Last Post: sedin
  Trying to do this .exist but it is always TRUE chong67 5 6,057 07-09-2012, 11:41 PM
Last Post: chong67

Forum Jump:


Users browsing this thread: 8 Guest(s)