iPhone UI Automation and the Page Object pattern

At the time when I was actively contributing to Selenium I used it only in conjunction with FitNesse and could therefore not directly apply the Page Object pattern. However, one of the key principles was for me the abstraction of the UI elements by creating UI maps which contain simple mappings of logical names to XPath path expressions.

The Page Object pattern defines the same abstraction: Define and use UI elements only in one module, and provide only service functions to the test cases.
Instead of diving deeper into theoretical details here is an example:

#import "Common.js"

function LoginView() {
    this.loginCells = window.tableViews()[0].cells();
    this.loginField = this.loginCells["loginFieldCell"].textFields()["loginField"];
    this.passwordField = this.loginCells["passwordFieldCell"].secureTextFields()["passwordField"];
    this.loginButton = this.loginCells["loginButtonCell"].buttons()["loginButton"];


LoginView.prototype.login = function(user, password) {

LoginView.prototype.waitForDisappear = function() {
So a test looks like as follows:

#import "../TestControllers/LoginView.js"
#import "../TestControllers/UserDetailView.js"

var loginView = new LoginView();
var userDetailView;

test("Valid login leads to user detail page", function(t, a) {
    userDetailView = new UserDetailView();
    userDetailView.assertUserData("andras_hatvani", "Andras Hatvani");

Although I use tuneup_js as test framework in this example, it could be Jasmine or a custom framework.
Important is that I could formulate the tests in a business-like language i.e. in an own DSL, thus it is not only straightforward to write, but also to read. Furthermore, if the UI changes, then I only need to adapt one single unit, namely LoginView.js to make my tests run again.


  1. Nice information about iPhone UI Automation and the Page Object pattern.People willing to get the indepth knowledge in getting framework such as TestNG,jenkins,Maven and POM should get properly get best selenium training in chennai

  2. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.. Selenium Training in Chennai

  3. Excellent explanation about iphone technology., its very interesting to read.. Thanks for sharing such a nice article. Dot Net Training in Chennai | Java Training in Chennai

  4. Nice and good article.. it is very useful for me to learn and understand easily.. thanks for sharing your valuable information and time.. please keep updating.

    Software Testing Training in chennai | Android Training in chennai

  5. Awesome Blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog. Selenium Training Institute in Chennai | ISTQB Training Institute in Chennai | Six Sigma Certification Training in Chennai


  6. Nice blog on Selenium Testing!!! I agree with your points, Testing will help whole organization to handle the projects in efficient manner.

    Selenium Training in chennai |
    selenium training in T Nagar 

  7. I wish to show thanks to you just for bailing me out of this particular trouble.As a result of checking through the net and meeting techniques that were not productive, I thought my life was done.
    java training in bangalore

  8. Wonderful blog. Thanks for sharing this informative blog. Keep updating.
    Final Year Project Center in Chennai | Final Year Project Center in Velachery


  9. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly. 
 Java Training Center in Chennai | Best J2EE Training Center in Chennai | No.1 Java Training Institution in Velachery | Core Java Training in Chennai

  10. Awesome blog, you explain everything in detailed manner, it was very interesting to read. Thanks for sharing such an informative blog. Automation Anywhere Training in Chennai | RPA Training Institute in Chennai | UI Path Training Institute in Chennai