WebDriver Page Factory Pattern Tutorial

Reading Time

WebDriver Page Factory pattern is one of the most common pattern used when writing web browser based tests. The Page Factory pattern is used to create objects representing web pages. The Page Factory pattern helps to write tests, tests which look more clean and easy to read.

WebDriver Page Factory Pattern Video Tutorial

webdriver page factory pattern

Direct Video Link

The Page Factory pattern is one of the most useful patterns to learn and use when writing tests where your tests are expected to interact with web pages. The patterns helps to map out the features of a given web page into a java class object.

Mo

I am a passionate tester, father, husband and gamer. I love to write blogs about Software Testing and generally contribute back to the Software Testing world.

More Posts - Twitter - Facebook

Published by

Mo

I am a passionate tester, father, husband and gamer. I love to write blogs about Software Testing and generally contribute back to the Software Testing world.

  • Kranti Biswakarma

    Hi,
    I have recently started with Protractor and have been watching you videos which are of great help. I tried creating my own script and running it but it fails every time with the following error-
    Message:
    Failed: Angular could not be found on the page http://www.thetestroom.com/js
    webapp/index.html : angular never provided resumeBootstrap

    Could you please help me getting started?
    Thanks in Advance.
    There is no provision to attach files thus I am pasting my test file below-

    describe(“This is my first test”, function(){
    it(“This test is to navigate to the facebook homepage”, function(){
    browser.get(“http://www.thetestroom.com/jswebapp/index.html”);
    element(by.model(‘person.name’)).sendKeys(“My name is Kranti”);
    element(by.binding(‘person.name’)).getText().then(function(text){
    console.log(text);
    });
    });

    });

    And below is the conf.js file-

    // An example configuration file.
    exports.config = {
    directConnect: true,

    // Capabilities to be passed to the webdriver instance.
    capabilities: {
    ‘browserName’: ‘chrome’
    },

    // Framework to use. Jasmine is recommended.
    framework: ‘jasmine’,

    // Spec patterns are relative to the current working directory when
    // protractor is called.
    specs: [‘mytest.js’],

    // Options to be passed to Jasmine.
    jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
    }
    };

    • Mo

      Thanks for watching my videos Kranti.

      Can you try the following:

      it(“This test is to navigate to the facebook homepage”, function(){
      browser.ignoreSynchronization = true;
      browser.get(“http://www.thetestroom.com/jswebapp/index.html”);

      By adding in the line above this should resolve your issue.

      Best,
      Mo