Skip to content

Commit 1590580

Browse files
committed
Addressing format issues
1 parent ce116e7 commit 1590580

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

docs/utility-guides/TableUtil.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@ The Table Utilities module provides helper functions to interact with and valida
99
- [Get Column Index](#get-column-index)
1010
- [Required Arguments](#required-arguments)
1111
- [How This Function Works](#how-this-function-works)
12-
- [Click first link in Column](#click-first-link-in-column)
12+
- [Click First Link In Column](#click-first-link-in-column)
1313
- [Required Arguments](#required-arguments-1)
1414
- [How This Function Works](#how-this-function-works-1)
15-
- [Click first input in Column](#click-first-input-in-column)
15+
- [Click First Input In Column](#click-first-input-in-column)
1616
- [Required Arguments](#required-arguments-2)
1717
- [How This Function Works](#how-this-function-works-2)
18-
- [\_format\_inner\_text](#_format_inner_text)
18+
- [Format Inner Text](#format-inner-text)
1919
- [Required Arguments](#required-arguments-3)
2020
- [How This Function Works](#how-this-function-works-3)
21-
- [get\_table\_headers](#get_table_headers)
21+
- [Get Table Headers](#get-table-headers)
2222
- [Required Arguments](#required-arguments-4)
2323
- [How This Function Works](#how-this-function-works-4)
24-
- [get\_row\_count](#get_row_count)
24+
- [Get Row Count](#get-row-count)
2525
- [Required Arguments](#required-arguments-5)
2626
- [How This Function Works](#how-this-function-works-5)
27-
- [pick\_row](#pick_row)
27+
- [Pick Row](#pick-row)
2828
- [Required Arguments](#required-arguments-6)
2929
- [How This Function Works](#how-this-function-works-6)
30-
- [pick\_random\_row](#pick_random_row)
30+
- [Pick Random Row](#pick-random-row)
3131
- [Required Arguments](#required-arguments-7)
3232
- [How This Function Works](#how-this-function-works-7)
33-
- [pick\_random\_row\_number](#pick_random_row_number)
33+
- [Pick Random Row Number](#pick-random-row-number)
3434
- [Required Arguments](#required-arguments-8)
3535
- [How This Function Works](#how-this-function-works-8)
36-
- [get\_row\_data\_with\_headers](#get_row_data_with_headers)
36+
- [Get Row Data With Headers](#get-row-data-with-headers)
3737
- [Required Arguments](#required-arguments-9)
3838
- [How This Function Works](#how-this-function-works-9)
39-
- [get\_full\_table\_with\_headers](#get_full_table_with_headers)
39+
- [Get Full Table With Headers](#get-full-table-with-headers)
4040
- [Required Arguments](#required-arguments-10)
4141
- [How This Function Works](#how-this-function-works-10)
4242

@@ -56,7 +56,7 @@ This function returns the index (1-based) of a specified column name.
5656
2. Iterates through header cells and matches text with `column_name`.
5757
3. Returns the index if found, otherwise raises an error.
5858

59-
### Click first link in Column
59+
### Click First Link In Column
6060

6161
Clicks on the first hyperlink present in a specified column.
6262

@@ -72,7 +72,7 @@ Clicks on the first hyperlink present in a specified column.
7272
2. Searches the first visible row in the column for an <a> tag.
7373
3. Clicks the first available link found.
7474

75-
### Click first input in Column
75+
### Click First Input In Column
7676

7777
Clicks on the first input element (e.g., checkbox/radio) in a specific column.
7878

@@ -88,7 +88,7 @@ Clicks on the first input element (e.g., checkbox/radio) in a specific column.
8888
2. Checks the first visible row for an <input> tag in that column.
8989
3. Clicks the first input found.
9090

91-
### _format_inner_text
91+
### Format Inner Text
9292

9393
Formats inner text of a row string into a dictionary.
9494

@@ -104,7 +104,7 @@ Formats inner text of a row string into a dictionary.
104104
2. Enumerates the result and maps index to cell value.
105105
3. Returns a dictionary representing the row.
106106

107-
### get_table_headers
107+
### Get Table Headers
108108

109109
Extracts and returns table headers.
110110

@@ -118,7 +118,7 @@ Extracts and returns table headers.
118118
2. Captures the visible text of each <th>.
119119
3. Returns a dictionary mapping index to header text.
120120

121-
### get_row_count
121+
### Get Row Count
122122

123123
Returns the count of visible rows in the table.
124124

@@ -132,7 +132,7 @@ Returns the count of visible rows in the table.
132132
2. Filters to include only visible rows.
133133
3. Returns the total count.
134134

135-
### pick_row
135+
### Pick Row
136136

137137
Returns a locator for a specific row.
138138

@@ -147,7 +147,7 @@ Returns a locator for a specific row.
147147
1. Builds a locator for the nth <tr> inside <tbody>.
148148
2. Returns the locator object.
149149

150-
### pick_random_row
150+
### Pick Random Row
151151

152152
Picks and returns a random row locator.
153153

@@ -161,7 +161,7 @@ None
161161
2. Uses a secure random generator to pick one.
162162
3. Returns the locator for that row.
163163

164-
### pick_random_row_number
164+
### Pick Random Row Number
165165

166166
Returns the number of a randomly selected row.
167167

@@ -175,7 +175,7 @@ None
175175
2. Randomly selects an index using secrets.choice.
176176
3. Returns the numeric index.
177177

178-
### get_row_data_with_headers
178+
### Get Row Data With Headers
179179

180180
Returns a dictionary of header-value pairs for a given row.
181181

@@ -191,7 +191,7 @@ Returns a dictionary of header-value pairs for a given row.
191191
2. Retrieves headers using get_table_headers.
192192
3. Maps each cell to its respective header.
193193

194-
### get_full_table_with_headers
194+
### Get Full Table With Headers
195195

196196
Constructs a dictionary of the entire table content.
197197

utils/table_util.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ def get_column_index(self, column_name: str) -> int:
3131
Finds the column index dynamically based on column name.
3232
Works even if <thead> is missing and header is inside <tbody>.
3333
34-
:param column_name: Name of the column (e.g., 'NHS Number')
35-
:return: 1-based column index or -1 if not found
34+
Args:
35+
column_name(str): Name of the column (e.g., 'NHS Number')
36+
37+
Return:
38+
An int (1-based column index or -1 if not found)
3639
"""
3740
# Try to find headers in <thead> first
3841
header_row = self.table.locator("thead tr").first
@@ -53,7 +56,9 @@ def get_column_index(self, column_name: str) -> int:
5356
def click_first_link_in_column(self, column_name: str):
5457
"""
5558
Clicks the first link found in the given column.
56-
:param column_name: Name of the column containing links
59+
60+
Args:
61+
column_name: Name of the column containing links
5762
"""
5863
column_index = self.get_column_index(column_name)
5964
if column_index == -1:
@@ -71,7 +76,9 @@ def click_first_link_in_column(self, column_name: str):
7176
def click_first_input_in_column(self, column_name: str):
7277
"""
7378
Clicks the first input found in the given column. E.g. Radios
74-
:param column_name: Name of the column containing inputs
79+
80+
Args:
81+
column_name: Name of the column containing inputs
7582
"""
7683
column_index = self.get_column_index(column_name)
7784
if column_index == -1:

0 commit comments

Comments
 (0)