Skip to content

Waits

Using wait methods you will be able to synchronize parts of the process waiting for something before performing a certain action.

Wait

You can make the process wait/sleep for an interval of time in milliseconds.

# Wait for 5 seconds.
bot.wait(5000)

# This will have the same effect as using wait.
bot.sleep(5000)
// Wait for 5 seconds.
wait(5000);
// Wait for 5 seconds.
await desktopBot.sleep(5000)
// Wait for 5 seconds.
await desktopBot.sleep(5000)

Wait for File

In addition to waiting for process situations, you can also wait for specific files.

# Waiting for the file to be available for up to 60 seconds.
if bot.wait_for_file(path="/my_directory/files/document.pdf", timeout=60000):
    print("The file is available!")
// Not yet implemented.
// Waiting for the file to be available for up to 60 seconds.
if (await desktopBot.waitForFile('/my_directory/files/document.pdf', 60000)) {
    console.log('The file is available!')
}
// Waiting for the file to be available for up to 60 seconds.
if (await desktopBot.waitForFile('/my_directory/files/document.pdf', 60000)) {
    console.log('The file is available!')
}