You can use logs to track the progress of your scripts and to better understand what is happening while the script is executing.
The simplest way to log messages is with print statements. You can use them to inspect objects or to determine where an issue is located.
For example, you can determine whether an element was selected on a page by displaying the contents of the object:
If the script results are incomplete, you can use a series of print statements to pinpoint where the problem might have occurred:
You can import the
logging package to log different types of error messages.
To import the
Once you have imported the
logging package, you can generate different types of logs:
The different types of errors are then color-coded in the waterfall of the Session Details dialog.
The script output will label the different log messages by the severity as shown below.