Reputation: 386240
My team has started to use selenium to do IE browser testing. One major sticking point is that selenium has a hard (read: seemingly impossible) time figuring out when a page has fully finished loading. We use a lot of javascript, a fair amount of AJAX, and a smattering of third party controls. Thus, it's hard to know when all of that activity has completed and the page is ready to test. Much of this code is legacy, so simply rewriting or refactoring the page is not an option -- it's a very large enterprisey app.
My main question is this: Is Watin any better in this regard? Does it have any sort of built-in mechanism for detecting when a page has fully loaded?
We unfortunately can't just wait for an element to become visible, which is the generally accepted practice for selenium. Often we are dealing with a scrolled list of dynamic elements and need to wait for the javacript to finish, as there is an indeterminate (to the test) number of elements on which we must wait.
Switching to another browser is simply not possible, we must find a solution that works with IE. I'm trying to decide if it's worth our time to investigate watin, or if we would just be trading one set of limitations for another.
Upvotes: 2
Views: 5068
Reputation: 2028
I used WatiN for quite a while and have more recently made the switch to Selenium because I feel it actually handles the situation you explain better than WatiN does (has a 'wait' that can be created on the driver in Selenium WebDriver). However, I think it really ends up being a matter of opinion. WatiN will only work well with IE, so you are limited to this and can't branch out into other browsers. Due to this, WatiN is made for IE, suggesting that you might have better success with it for IE.
As a side note, have you tried using Windows calls to check if a browser has finished loading? I believe this is possible? An the addition of XPath in Selenium can be rather useful, though slow with IE.
EDIT: Alternatively, couldn't you call some javascript to see when the javascript on the page has finished?
EDIT EDIT: Also this post covers a lot of comparisons and opinions.
Upvotes: 3
Reputation: 912
Well as far as my work with WatiN goes it's easier than Selenium. We too have a lot of javascript, ajax - my solution for that is using
WebBrowser.Current.Div(ids.waitForBagGridToLoadIdentifier).WaitUntil("style", "display: none;");
to wait for a particular javascript to finish it's work. There is probably a similar approach for Selenium.
Upvotes: 1