I'm writing a UI testing suite for a single page javascript application using Selenium 2 web driver. I'm still experimenting with how to fit the app inside a page object model. At the moment I am considering the use of the Selenium LoadableComponent pattern for various subpages in the application.

The isLoaded() function makes sense since I frequently need to make check certain elements are visible/enabled to determine if the the subpage is correctly loaded. On the other hand I can't really figure out how to make use of the load() method, since a subpage is not directly accessible by a URL, but rather requires navigating through the app. All the examples I have found use URLs to navigate in the load()?

Anyone have experience or design pattern ideas with automated SPA javascript apps? Basically I want to be able to navigate and wait for things to load as cleanly as possible.

More on LoadableComponent: Is Selenium's LoadableComponent a good solution as test design pattern?

1 Answer 1


I can tell you what I do in this situation. I have not used the LoadableComponent, however what I have done has followed a similar pattern. I create classes for each of the "loadable components" that are basically page objects. I have something like the IsLoaded function to ensure that the component is loaded, and depending on how it works I either don't implement a Load function at all, or I have the load function go through the clicks to get the component to load. For example, if loading a component simply means clicking on an item in a menu or some other simple action or sequence of actions, I implement the load function. If it requires doing something more complex such as filling out a form first, I usually do not.

In the case where I don't have a Load function, I usually call the IsLoaded functions within other helper functions, so for example if I have a sign up page, I have a function called SignUp that will fill in the form and then call IsLoaded on the page/component that should be loaded next.

  • Yup. Working through it in C#, I ended up with simple IsLoaded() and HasDisappeared() functions using the WebDriverWait Until() to check for elements on the loading or un-loading screen. So I think the pattern make sense, but not necessarily needing the LoadableComponent interface.
    – craastad
    May 17, 2013 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.