selenium page objects101
DESCRIPTION
Page Objects are a way of representing a page in an OO manner. This presentation introduces an implementation of the pattern and its components.TRANSCRIPT
Page Objects101
Adam Goucher@adamgoucher
Wednesday, July 27, 2011
A language neutral pattern for representing a complete page
or portion of a page in an Object Oriented manner.
Wednesday, July 27, 2011
3 [Big] Reasons
1.Maintenance
2.Readability of Scripts
3.Separation of Concerns
Wednesday, July 27, 2011
Scripts & Page Objects
Wednesday, July 27, 2011
Page Objects
Wednesday, July 27, 2011
Locators
•A specific locator appears only once in your entire set of PO
•Locators do not cross PO boundaries
Wednesday, July 27, 2011
Elements
•Anything directly interacted with [via Selenium] is an Element
•Elements override Get/Set
Wednesday, July 27, 2011
Tip - Create common base classes for
Elements
Wednesday, July 27, 2011
Actions
•Repeated series of commands
•[Usually] Named with verbs
•[Often] Require Sync
Wednesday, July 27, 2011
Synchronization
• In Synchronization
•Out Synchronization
• ‘Flag’ driven
Wednesday, July 27, 2011
Tip - Create custom wait_for_* method in a
common base PO
Wednesday, July 27, 2011
1.Locator
2.Element Implementation
3.Add Element to Page Object
4.Actions
Order of Operations
Wednesday, July 27, 2011
Tip - Do NOT create the whole PO at once. Do ONLY what you
need now.
Wednesday, July 27, 2011
Asserts do not belong in PO
Wednesday, July 27, 2011
Scripts
Wednesday, July 27, 2011
Do not have synchronization code
Wednesday, July 27, 2011
Do not have driver API calls
Wednesday, July 27, 2011
Do have interactions with PO
Wednesday, July 27, 2011
Do have asserts
Wednesday, July 27, 2011