This article shows how to improve your scripts using the Wait for Target action. The Wait for Target is an explicit action in Foxtrot allowing you to wait for a certain target to either appear or disappear before proceeding in the project. All targets do offer an implicit wait like shown here:
The implicit wait will essentially do the same as the Wait for Target action, however, in some cases, it is best to have an explicit wait to make sure that your Foxtrot project is more clear and maintainable.
To sum up, there are three different ways of "waiting" during your project:
- The implicit wait in the individual actions
- The Wait for Target action
- The Wait action (this is a simple hardcoded wait)
In the attached file (find at the end of the article), you can find an example of how to build a script using Wait for target and Set speed. You can download the script and try to run it. Remember to save the Foxtrot Project File to the same location as your other projects, typically in this destination: C:\ProgramData\Foxtrot Suite
- Some actions may require more timing allocations in which Max Speed is not recommended. For example, if the web page responses very slow. A Set Speed action may be used in these scenarios to alter the speed at any point in a script. Foxtrot starts by setting the speed to 11 and then goes to a website.
- In general, Foxtrot will wait for a webpage to refresh, or certain elements to appear on the screen before continuing. However, sometimes it may be necessary to verify that Foxtrot is not moving faster than the target application. By performing a Wait for Target action instead, Foxtrot will wait until something unique appears on the screen. Please note that when using Wait for Target action you can specify the exact time to wait.
- At step 7 there is an If statement. In the If statement Foxtrot determines whether or not the message is visible on the screen. And based on that it performs actions.