Forum Discussion

Josh_147's avatar
Josh_147
Contributor
2 years ago
Solved

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++; 
}

 

  • 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)

     

9 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    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)

     

    • Josh_147's avatar
      Josh_147
      Contributor

      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? 

    • Josh_147's avatar
      Josh_147
      Contributor

      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.

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3
        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's avatar
    Marsha_R
    Champion Level 3
    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.
    • Josh_147's avatar
      Josh_147
      Contributor

      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's avatar
    rraghvani
    Champion Level 3

    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,

    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.