Skip to content

Commit 97e0f39

Browse files
committed
modified a table util function to work for report tables where unable to click on first link
1 parent 0f69d8c commit 97e0f39

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

utils/table_util.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ def get_column_index(self, column_name: str) -> int:
3434
:param column_name: Name of the column (e.g., 'NHS Number')
3535
:return: 1-based column index or -1 if not found
3636
"""
37-
header_row = (
37+
# Try to find headers in <thead> first
38+
header_row = self.table.locator("thead tr").first
39+
if not header_row.locator("th").count():
40+
# Fallback: look for header in <tbody> if <thead> is missing or empty
41+
header_row = (
3842
self.table.locator("tbody tr").filter(has=self.page.locator("th")).first
3943
)
4044

0 commit comments

Comments
 (0)