automation - How can I call exceptions or functions instantaneously in Python program execution? -


i have application automated through python script. application may hang or crash anytime unknowingly. hence need write exception or function handle same.

i have call exception or function if running in background , should revoked whenever crash or hang happens.

for ex: consider python script doing automation on application. doing following...

  1. open application
  2. browse on icon
  3. clicks on icon
  4. select file
  5. upload file
  6. close application

during of these steps, crash or hang may occur in application , have different "function/ method" each of steps. how invoke exception @ every steps.

i know easy in java like: public void openapp() throws crashexception, errorexception {

but don't know how same in python. please me same.

1)you can see here built-in exceptions in python.

2)this post examines differences between python , java regarding exception handling.

3)for simple exception handling in python taken here:

 def divide(x, y):      try:         result = x / y     except zerodivisionerror:         print "division zero!"     else:         print "result is", result     finally:         print "executing clause" 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -