Copyright © 2017, edureka and/or its affiliates. All rights reserved. Agenda
Copyright © 2017, edureka and/or its affiliates. All rights reserved. Agenda For The Session i. Why Use Page Object Model (POM)? ii. What Is Page Object Model? iii. What Is Page Factory? iv. Demo: Creating POM & Page Factory
Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why Use Page Object Model? A Web page has ‘x’ no. of elements, which are used in multiple test cases. Now if the path/locator of any element changes, then what happens? PROBLEM STATEMENT A web page with ‘x’ elements OH MY GOD !! Do I have to change the element locators in entire test script? Test Script SOLUTION Test case Element locator
Copyright © 2017, edureka and/or its affiliates. All rights reserved. What Is Page Object Model? Page Object Model is a design pattern to create an Object Repository for web UI elements. Here, all the element locators used by the application will be stored in a class file separately from test case. Test Case Page Class Locators & test script stored separately POM Design Pattern • Element locators • Methods performing operations on elements. Page Class contains • Actual test scenario • Calls to methods in page class with arguments. Test Case contains
Copyright © 2017, edureka and/or its affiliates. All rights reserved. What Is Page Factory? POM Implementation With Page Factory Without Page Factory • Uses By(). • No imports needed. • No cache storage. • Uses @FindBy(). • Import package: Page factory. • Cache lookup is faster. Page Factory is a built-in class in Selenium for maintaining object repository. (Import package: Page Factory) With Page Factory, initElement() statement can be used for easily looking up elements in page class. Page Factory allows storing of page elements in cache memory using @CacheLookup annotation. 1. Maintainability 2. Reusability 3. Flexibility 4. Optimized code ADVANTAGES
Copyright © 2017, edureka and/or its affiliates. All rights reserved. Hands-on:- Page Object Model & Page Factory Let’s learn how to implement POM & Page Factory.
Copyright © 2017, edureka and/or its affiliates. All rights reserved. Session In A Minute Why Use Page Object Model? What Is Page Factory? What Is Page Object Model? Demo: POM & Page Factory In Selenium
Copyright © 2017, edureka and/or its affiliates. All rights reserved. WebDriver vs. IDE vs. RC ➢ Data Warehouse is like a relational database designed for analytical needs. ➢ It functions on the basis of OLAP (Online Analytical Processing). ➢ It is a central location where consolidated data from multiple locations (databases) are stored.

Selenium Page Object Model Using Page Factory | Selenium Tutorial For Beginners | Edureka

  • 1.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. Agenda
  • 2.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. Agenda For The Session i. Why Use Page Object Model (POM)? ii. What Is Page Object Model? iii. What Is Page Factory? iv. Demo: Creating POM & Page Factory
  • 3.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. Why Use Page Object Model? A Web page has ‘x’ no. of elements, which are used in multiple test cases. Now if the path/locator of any element changes, then what happens? PROBLEM STATEMENT A web page with ‘x’ elements OH MY GOD !! Do I have to change the element locators in entire test script? Test Script SOLUTION Test case Element locator
  • 4.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. What Is Page Object Model? Page Object Model is a design pattern to create an Object Repository for web UI elements. Here, all the element locators used by the application will be stored in a class file separately from test case. Test Case Page Class Locators & test script stored separately POM Design Pattern • Element locators • Methods performing operations on elements. Page Class contains • Actual test scenario • Calls to methods in page class with arguments. Test Case contains
  • 5.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. What Is Page Factory? POM Implementation With Page Factory Without Page Factory • Uses By(). • No imports needed. • No cache storage. • Uses @FindBy(). • Import package: Page factory. • Cache lookup is faster. Page Factory is a built-in class in Selenium for maintaining object repository. (Import package: Page Factory) With Page Factory, initElement() statement can be used for easily looking up elements in page class. Page Factory allows storing of page elements in cache memory using @CacheLookup annotation. 1. Maintainability 2. Reusability 3. Flexibility 4. Optimized code ADVANTAGES
  • 6.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. Hands-on:- Page Object Model & Page Factory Let’s learn how to implement POM & Page Factory.
  • 7.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. Session In A Minute Why Use Page Object Model? What Is Page Factory? What Is Page Object Model? Demo: POM & Page Factory In Selenium
  • 8.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. WebDriver vs. IDE vs. RC ➢ Data Warehouse is like a relational database designed for analytical needs. ➢ It functions on the basis of OLAP (Online Analytical Processing). ➢ It is a central location where consolidated data from multiple locations (databases) are stored.