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
The Table Utilities module provides helper functions to interact with and validate HTML tables in Playwright-based UI tests.
3
+
The Table Utilities module (`utils/table_util.py`) provides helper functions to interact with and validate HTML tables in Playwright-based UI tests.
4
+
**This utility is designed to be used inside Page Object Model (POM) classes** to simplify table interactions and assertions.
4
5
5
6
## Table of Contents
6
7
@@ -9,227 +10,193 @@ The Table Utilities module provides helper functions to interact with and valida
9
10
-[Using the Table Utility](#using-the-table-utility)
10
11
-[Example usage](#example-usage)
11
12
-[Get Column Index](#get-column-index)
12
-
-[Required Arguments](#required-arguments)
13
-
-[How This Function Works](#how-this-function-works)
13
+
-[Example](#example)
14
14
-[Click First Link In Column](#click-first-link-in-column)
15
-
-[Required Arguments](#required-arguments-1)
16
-
-[How This Function Works](#how-this-function-works-1)
15
+
-[Example](#example-1)
17
16
-[Click First Input In Column](#click-first-input-in-column)
18
-
-[Required Arguments](#required-arguments-2)
19
-
-[How This Function Works](#how-this-function-works-2)
17
+
-[Example](#example-2)
20
18
-[Format Inner Text](#format-inner-text)
21
-
-[Required Arguments](#required-arguments-3)
22
-
-[How This Function Works](#how-this-function-works-3)
19
+
-[Example](#example-3)
23
20
-[Get Table Headers](#get-table-headers)
24
-
-[Required Arguments](#required-arguments-4)
25
-
-[How This Function Works](#how-this-function-works-4)
21
+
-[Example](#example-4)
26
22
-[Get Row Count](#get-row-count)
27
-
-[Required Arguments](#required-arguments-5)
28
-
-[How This Function Works](#how-this-function-works-5)
23
+
-[Example](#example-5)
29
24
-[Pick Row](#pick-row)
30
-
-[Required Arguments](#required-arguments-6)
31
-
-[How This Function Works](#how-this-function-works-6)
25
+
-[Example](#example-6)
32
26
-[Pick Random Row](#pick-random-row)
33
-
-[Required Arguments](#required-arguments-7)
34
-
-[How This Function Works](#how-this-function-works-7)
27
+
-[Example](#example-7)
35
28
-[Pick Random Row Number](#pick-random-row-number)
36
-
-[Required Arguments](#required-arguments-8)
37
-
-[How This Function Works](#how-this-function-works-8)
29
+
-[Example](#example-8)
38
30
-[Get Row Data With Headers](#get-row-data-with-headers)
39
-
-[Required Arguments](#required-arguments-9)
40
-
-[How This Function Works](#how-this-function-works-9)
31
+
-[Example](#example-9)
41
32
-[Get Full Table With Headers](#get-full-table-with-headers)
42
-
-[Required Arguments](#required-arguments-10)
43
-
-[How This Function Works](#how-this-function-works-10)
33
+
-[Example](#example-10)
44
34
45
35
## Using the Table Utility
46
36
47
-
To use the Table Utility, import the `TableUtils` class into your POM file and then define the actions using the its methods as needed.
37
+
To use the Table Utility, import the `TableUtils` class into your Page Object Model (POM) file and instantiate it for each table you want to interact with.
48
38
49
-
## Example usage
50
-
51
-
Below is an example of how the TableUtils used in reports_page.py
39
+
```python
40
+
from utils.table_util import TableUtils
52
41
53
-
from utils.table_util import TableUtils
54
-
class ReportsPage(BasePage):
42
+
classReportsPage(BasePage):
55
43
"""Reports Page locators, and methods for interacting with the page."""
This function returns the index (1-based) of a specified column name. 1-based indexing means the first column is considered index 1 (not 0 as in Python lists).
73
-
If the column is not found, the function returns -1.
56
+
Below are examples of how to use `TableUtils` methods inside your POM methods or tests:
74
57
75
-
#### Required Arguments
58
+
```python
59
+
# Click the first NHS number link in the reports table
0 commit comments