I
I
Ivan Petrov2017-01-26 20:01:04
Python
Ivan Petrov, 2017-01-26 20:01:04

Is there a good example of page object pattern in python?

Is there a good example of page object pattern in python?
I saw one example, but did not understand why to take out the locators (page elements) in separate classes, and not declare them in the page class.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
azShoo, 2017-01-27
@bitande

An example of laziness to google, it's easier to answer your question.
Page Object divides autotests into three levels:
1 - Locators. It is, in fact, a set of constants.
It is necessary to separate them into separate files and classes for two main reasons:
- It is easier to maintain and update them this way. And the fight against "outdated" locators is almost half of all the work to support autotests in working order.
- In order to be able to refer to the same element within different pages.
2 - Pages and their objects:
This level of abstraction contains the business logic of the application and its interface implementation.
This approach, again, simplifies support. The structure of autotests corresponds to the structure of the interface.
3 - Logic of tests.
It already contains specific steps and asserts for them.
This division allows you to clearly understand what and where you need to change depending on the situation.
The element has changed, but the application logic remains the same - the locator has been replaced. The logic and structure of the application has changed - you update Page. You need to update\add the test itself (i.e. the sequence of steps and Expected Result) -> change the test itself.
Hope it helps. :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question