A basic fact about web browsers I was totally ignorant of

You learn something new everyday, and sometimes you learn that you don’t really understand some fundamental things.  So, let’s share johnny the developer’s ignorance.

Background:  I was setting up some WatiN automated acceptance tests for an older Asp.NET Web Forms site.

<digression> I was using WatiN because I’ve used it before, but it looks like it hasn’t been updated in a year.  Is it no longer an active project?  Should I be looking at WebDriver instead?</digression>

WatiN natively uses a lot of magic strings, and so there is a lot of ‘opportunity’ to fat finger stuff, and of course, that’s what I did.  I was doing something really basic:  setting up a test to ensure that when the value of DropDownList1 changed, the items in DropDownList2 were repopulated properly.  Since I fat fingered the control to look for, the test failed.

Not seeing my obvious typo, I did a view source of the page.   Blink.  WTF.  The view source did not show what was actually rendered.  I called over another of the web developers, and he too was surprised at this.

Another developer asked if I was using an UpdatePanel.  I didn’t create the site, but yes, that is something that was being utilized, but that still didn’t make sense to me.  Shouldn’t the view source reflect the state of the page after all rendering was done?

Turns out the answer is, well, no.  As Johnny Carson might have said, I….I did not know that <digression>To the kids out there, you see, Johnny Carson was this famous TV personality who….oh never mind</digression>.  When content is dynamically updated in a page through AJAX, Javascript, etc. in many browsers, ‘View Source’ simply doesn’t reflect it.  There are other ways and various tools you can use to see the underlying ‘source’, but view source isn’t reliable.

Like the other developer I asked, it isn’t something that I had ever looked at before, and never thought to question it.

posted on Wednesday, June 20, 2012 9:24 PM Print
# re: A basic fact about web browsers I was totally ignorant of
6/29/2012 10:26 AM
WebDriver is the most up to date, best supported technology for drive-the-browser type tests. It has the backing of most of the major browser vendors.

Also, UpdatePanel is lame.
# re: A basic fact about web browsers I was totally ignorant of
6/29/2012 10:43 AM
the syntax looked kind of sucky, but I only looked at it for 3 minutes, so I'll take another look.

Yeah, I'll re-architect the site. Next week.

Post Comment

Title *
Name *
Comment *  
Please add 8 and 2 and type the answer here: