One of the major pain points of developing and maintaining automation scripts is debugging script failures. Often times, when I’m trying to fix an automation script I would make a webdriver code change, run my script, try another webdriver command, and run the script again. I would continue this process until the script is passing, but this process is very time consuming.

To help with the debugging process, there is a rubygem called pry which lets you enter an interactive debugger at any point in your script. Before the point of fail, simply insert the command binding.pry. When the script reaches this point, it will pause the script and put you in debugger session where you can try multiple webdriver commands.

Lets take a simple script that you created:

You could try executing this script in Awetest and it will fail (It doesn’t find the Finance Link)

Now simply insert binding.pry into the script:

Now you can try both, Awetestlib and Watir Web-Driver commands directly in the pry window and execute multiple commands to test/debug your script

Pry also works amazing with the Awetest DSL. When you are in a pry debugging session within an Awetest script, you will have full access to our Awetest DSL. This allows scripters to write their automation script and test their commands at the same time.

I highly recommend anyone writing automation tests to try out the pry gem and let us know your thoughts on it!