Don't Let the HTML Escape!

Posted Aug 22nd, 2013

Your HTML is precious. You’ve gone to an awful lot of effort to generate it. But HTML is wily and it is tricksy. Given half a chance it’ll render into a webpage or be mutated with Javascript, then vanish, never to be seen again. How can you diagnose your UI issues without the source? (By looking at the screenshots and video mostly, but sometimes you just have to get all covered in pointy brackets.)

Let’s stop our HTML escaping. We’ll use that old trick, using a carrot under a box, resting on a stick tied with a string. Except with Sauce Labs instead of the box. And the capture-html desired capability instead of the string. And instead of a carrot, a torturous metaphor. You can ask your instance of WebDriver for the source at every test step sure, but it’s faster to get Sauce Labs to do it for you — There’s no transferring HTML across the internet every page fetch.

To do this using the Sauce gem, we just add the capture-html capability in our config block:

[code lang=”ruby” gutter=”false”]
Sauce.config do |c|

All WebDrivers support this feature when used on Sauce Labs; the capability name is always the same, just set it to whatever your tool & language consider truthy.

HTML escape

Don’t let your HTML get away!

Written by



Programming languages