When interviewing candidates for UI automation openings, I like to give them typical automation ‘problems’ to solve. Most of the problems provide them with a picture of a UI and the corresponding HTML, and ask how they would automate something given a tricky DOM. I’m finding that many of the candidates have experience in writing automation scripts, but are still stomped by these interview questions. Many of them respond with “I’d need Firebug to answer that”.

why

Please don’t be so dependent on Firebug, or any other browser’s dev tool. They are great to show you the DOM, but you should not rely on them to accurately give you proper handles to elements. Especially not in this day of modern web development where applications are being created with fancy Javascript libraries that pretty much guarantee a dynamic DOM.

js

Blindly depending on Firebug’s xpath or css selector recommendations is a sure-fire path to unstable scripts. I honestly can’t think of the last time I coded a scenario and was able to rely on the static identifiers for 100% of the elements involved in the scenario. There’s always one or two that require a bit more thought on how to reliably get a handle to it in different situations. As an automation engineer, it makes maintenance a lot more manageable if you develop your scripts with a good understanding of the DOM (including the relationships between nodes), and how to craft reliable xpath and css selectors.

Are you ready to fire Firebug? Or at the very least, be able to question the information it provides you? If so, here are some resources I’d recommend to help you be more efficient at identifying elements:

Understanding the DOM

Xpath Statements

CSS Selectors

Locators for UI Automation