Cross-Browser Web Application UI Test Automation

Suppose you want to test a Web application through its user interface. Over the past couple of years I’ve written several articles for Microsoft’s MSDN Magazine that demonstrate different ways to do this, but in all cases I assumed you are working in a 100% Microsoft environment and using Internet Explorer. Two of the techniques available to you are to write a C++ or C# language program which calls directly into the IE COM-based API set, or to use JavaScript to call into the IE DOM. The JavaScript approach is often a good choice and works well for Internet Explorer but doesn’t always work with other browsers because of differences between browser DOMs. For example, with IE v4.0, to get a reference to a button with ID = "Button1" you can write var btn = document.all["Button1"] but with IE v5.0 and above and Firefox you could write var btn = document.getElementById("Button1"). Although you can write your test automation code to sense which browser is being used and then branch to correct JavaScript, an alternative is to use the nice jQuery library. The jQuery library is essentially a set of JavaScript wrapper functions which are for the most part browser-independent. 
This entry was posted in Software Test Automation. Bookmark the permalink.