BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Debugging Tips for Selenium Test Failures

Debugging Tips for Selenium Test Failures

Leia em Português

Bookmarks

While Selenium has gained wide acceptance as a useful tool for automating browser-level tests, tracking down the cause of test failures can take significant time. Daniel Wellman has shared two of his best tricks to greatly reduce debugging time for failed Selenium tests.

The first technique is to capture a screenshot any time a test fails. There are a couple of methods provided to support this: captureScreenshot, and captureScreenshotToString. The post Capture Screenshots of Selenium Failures, on the YouDevise Developer blog provides some example Java code for how this approach might be implemented.

The second technique is to capture the HTML DOM contents when a test fails. For this, Wellman recommends using the method getHtmlSource to capture the contents of the DOM and write them out to a file.

Taking the time to incorporate these two techniques could pay off handsomely in time saved debugging. This is not the first time that Wellman has written about the value of investing in your tools to gain more productivity. What improvements have you made to your toolset, testing or otherwise, that had big payoffs for you? Leave a comment and share with the InfoQ community.

Rate this Article

Adoption
Style

BT