By December 2, 2009

Difficult Watij Problem That Wasn’t Really A Watij Problem

Don't you hate it when you spend a large amount of time dealing with a problem only to find out what you thought was the issue really wasn't the issue after all? I spent a significant amount of time today trying to find out why I couldn't access a link that I can see on a web page and in the DOM when using the IE DevToolBar. I thought it was a problem with the automated testing framework I use, Watij. But, it turns out what I thought was a Watij problem really wasn't.

I was trying to write an automated acceptance test to verify that a birth date could not be made null.

Pop quiz, what's wrong with this HTML?

<!-- This is a comment --!>

It turns out that IE can recognize that “–!>” is intended to be the end of a comment even though it should be:

<!-- This is a comment -->

Unfortunately, Watij is not as forgiving and does not recognize the intention behind this mistake.  In fact, Watij treats the comment as not ending, and the rest of the page as a comment.

So, the lesson behind this, is that if you are using a WatiX framework and can't see a link or image on a page, be sure to check and make sure you have well formed comments. Better yet, anytime  you come across something similar, make sure all your html is well formed.

About the author

John Sonmez

John Sonmez is the founder of Simple Programmer and a life coach for software developers. He is the best selling author of the book "Soft Skills: The Software Developer's Life Manual."