You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/page-objects.rst
+12-3Lines changed: 12 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,14 @@ Page Objects
14
14
15
15
This chapter is a tutorial introduction to page objects design
16
16
pattern. A page object represents an area in the web application user
17
-
interface that your test is interating. Page objects reduces the
18
-
amount of duplicated code and if the user interface changes, the fix
19
-
need only changes in one place.
17
+
interface that your test is interacting.
18
+
19
+
Benefits of using page object pattern:
20
+
21
+
* Creating reusable code that can be shared across multiple test cases
22
+
* Reducing the amount of duplicated code
23
+
* If the user interface changes, the fix needs changes in only one place
24
+
20
25
21
26
Test case
22
27
~~~~~~~~~
@@ -64,6 +69,8 @@ and ensure some results are found.
64
69
Page object classes
65
70
~~~~~~~~~~~~~~~~~~~
66
71
72
+
The page object pattern intends creating an object for each web page. By following this technique a layer of separation between the test code and technical implementsation is created.
73
+
67
74
The ``page.py`` will look like this::
68
75
69
76
from element import BasePageElement
@@ -136,6 +143,8 @@ The ``element.py`` will look like this::
136
143
Locators
137
144
~~~~~~~~
138
145
146
+
One of the practices is to separate the locator strings from the place where they are being used. In this example, locators of the same page belong to same class.
0 commit comments