It is possible to abort/stop test scripts, but the actual mechanism depends on the scripting language being used.
For Python and JavaScript the best way is to use their exception handling mechanisms.
In both cases the mechanism used to abort the test script results in an exception being thrown — and this exception can be caught in the main() function. Furthermore it is also possible to tell this exception apart from regular exceptions that can occur at runtime.
The following examples demonstrate how to do this.
We would like to use Google Analytics to get a better understanding of how
you use the website.
By agreeing to this, your usage data will be stored in the USA and processed
by Google LLC. Both Google as well as federal US agencies can access this data
and combine it with any other data about you, such as your search history,
personal accounts or any other data known to Google.