Interactive Prompts Revisited
NOTE: This is a guest post from Brian Goad of DigitalSmiths.
Intro
In a previous tip we covered how a REPL can help you determine what code to write in your scripts by testing locators and actions through an interactive prompt. This is great for simple tasks, but its starts to falter when debugging more complex scripts.
Often times you will find yourself puzzling over an error or failure occurring in the middle of your script. It is not very efficient to have to run through each command in your script, line by line, to get to the context of the place you are attempting to debug in a simple REPL. Usually, you have already setup some framework, boilerplate, and helper code to assist you in writing your script. This just adds on to the problem, as you have no easy way to view the objects or methods available to you while debugging in your script.
Sometimes you just need to be able to pry into the code, jump in, open it up and explore the area in order to solve the error you are experiencing.