Ask a Question

How To Set Auto-Wait Time Out More Than 1,000,000ms

SOLVED
Josh_147
Contributor

How To Set Auto-Wait Time Out More Than 1,000,000ms

Hi all,

 

I have some test cases which required to set the auto-wait time out more than 1,000,000 ms and I found that 1,000,000 is the maximum time out can be set.

Is there any possible method to achieve this?

 

I found this topic, Default Auto Wait time out can be set max to 1000000ms but I will get the error: Cannot obtain the window with the window class <....>. See Details for additional information. Details: The window with the specified attributes does not exist.

The TestComplete will not enter the while loop since it cant find the object yet, because I'm still waiting for it and that's the purpose why I'm using time out.

var LoopCount = 0
while (!Object.Exists) and (LoopCount < 30) do
{
    Delay(60000);
    LoopCount++; 
}

 

9 REPLIES 9
Marsha_R
Community Hero

Instead of using Exists directly, use the WaitNNN method.  Take a look at the In Script Tests section here

https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/checking-existence.html


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

Hi @Marsha_R ,

 

Thanks for the reply. For the suggestion of using WaitNNN, this method hardcoded the waiting time and it doesn't suit for my cases. The reason why I need a longer time out is I want to let the time out to be shared among different test cases and use it to cater all the cases, because the object has different appear timing.

Okay, but why does the time out need to be the same everywhere? I don't know if that gains anything for you.

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

The time out is shared among different test cases. For example I got 10 test cases and the object will appear in 10 different timing between 15 to 25 minutes. So, I will use a 30 minutes time out to wait for the object to appear on screen instead of set 10 different time outs for each of the test case.

Marsha_R
Community Hero

You can make a function using the WaitNNN with the common wait time and then call the function when you need it. It could still be hardcoded but you would only have one place to change it.

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

If using this method, would the test log will show The object "..." does not exist. error? Sorry that I not yet try on the WaitNNN method as I tried the Do While method as below:

 

LoopCount = 0
do while not (Aliases.Object.VisibleOnScreen)
    If LoopCount < 10 Then
Delay(5000)
    LoopCount=LoopCount+1 
End If
Loop

I will get the The object "..." does not exist. error while every time it entered the while loop. Can I hide the error from showing in the test log?

rraghvani
Trusted Contributor

The example code below will wait until Edge Tab is opened or until time limit is reached i.e. 17 minutes (1020000 seconds)

function Wait()
{
    var timer = 0;
    var then = aqDateTime.Now();
    var now = then;
    
    while ((now - then) < 1020000 && !Sys.Browser("edge").WaitChild("Page(\"edge://newtab/\")", 1000).Exists)  {
        timer++;
        now = aqDateTime.Now();
    }
    
    Log.Message(`Waited ${timer} seconds`);
}

It will not throw an error if it can't find the object (base on the Object Browser)

rraghvani_0-1662630502509.png

 

Hi @rraghvani ,

 

Thanks for the reply. I tried your method and I encountered an issue which is even though the object exists but it is not focused, then the while loop still keep running due to can't find the object. Do you experience this? 

rraghvani
Trusted Contributor

I suggest you get the UI Object to appear and then run this simple code (do change the parameters),

 

if (!Sys.Browser("edge").WaitChild("Page(\"edge://newtab/\")", 30000).Exists) {
	Log.Error("Unable to find object within the time limit.")
}

 

If it fails to find the UI Object within 30 seconds, then it might help changing these project settings,

rraghvani_0-1662710597361.png

In the web application that I test, we have certain controls that overlap each other, even though it doesn't look like it. I can verify this by looking at the HTML code, and I'll have to enable 'Ignore overlapping window'. 

 

All application that are developed, the UI controls may look the same, but the behaviour can be different.

cancel
Showing results for 
Search instead for 
Did you mean: