Wednesday, 14 May 2014

Why We use Page Objects for Selenium

Why use page objects?
  • Maintenance
  • Readability of scripts
  • Reduced or eliminated duplication
  • Reusability

Some Advantages : 

- Separation between test code and locators
- Class acts as an interface to actual page of application
- You can use methods of page object whenever you want to interact with GUI

 Location:
org.openqa.selenium’   ----->    org.openqa.selenium.support.PageFactory  


@FindyBy :  You can either use this annotation by specifying both "how" and "using" or by specifying one of the location strategies (eg: "id") with an appropriate value to use.

@CacheLookup : annotation is being used to eliminate the searching of the web element every time an action is performed