3

Function used for waitForObject is below. I want everytime this function it used it waits for default amount of seconds.

def login():
    type(waitForObject(names.login_lineEditUserId_QLineEdit), "786")

3 Answers3

7

The default timeout for waitForObject() is testSettings.waitForObjectTimeout. It can be changed in settings.xml, or in your test script, or from the Test Settings - AUT tab (Squish 6.4 only).

https://doc.froglogic.com/squish/latest/rgs-squish.html#testSettings.waitForObjectTimeout-property

With best Regards,

Alan Ezust

Alan Ezust
  • 106
  • 1
0

If you want that the timeout depends on the line of your code, modify the call by adding the timeout in milliseconds as last argument of the WaitForObject function.

For example, for a timeout of 4 seconds, change your code from :

type(waitForObject(names.login_lineEditUserId_QLineEdit), "786")

to :

type(waitForObject(names.login_lineEditUserId_QLineEdit, 4000), "786")

It works the same way for WaitForObjectItem and WaitForObjectExists.

Note : The default value for the timeout is 20 seconds.

0

I made all necessary changes in settings.xml, and all other AUT settings (nothing worked for me apart from physically throwing a snooze function in between).

Currently I just use time.sleep(40), since 40 is a magic number, you can just declare them in a global file and call it every time you want to use those objects.

Just to be clear:

  1. Time.sleep(30) // this way the system waits for 30 seconds before executing line 2
  2. type(waitForObject(names.login_lineEditUserId_QLineEdit), "786") // Avoid using co-ordinates because if objects or window move those position then your test would fail, by mapping your object, squish will just find those objects with a specific id)

Don't forget to add import time at the beginning of your program.

Acapulco
  • 3,373
  • 8
  • 38
  • 51