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
{{ message }}
Repository navigation
Locator.rows() — header-keyed table extraction as List<Map<String,String>> #53
Locator.elements() (src/main/java/com/seleniumboot/locator/Locator.java:301-305) returns matched WebElements but nothing in Locator understands <table> structure. Extracting an HTML table today means raw nested findElements loops (thead for headers, tbody tr for rows, td per row) with manual index bookkeeping to zip each cell to its header — there's no helper anywhere in Locator or BasePage for this.
Why it matters
Every table-driven test re-implements the same header-to-cell zip logic by hand.
Proposed API
// Locator.java, terminal actions section, built on top of elements()publicList<Map<String, String>> rows() {
// resolve this locator to a <table> (or a container of rows),// read header text from `th` (or first `tr`) as the map keys,// then for each body row zip cell text to the matching header key
}
// usageList<Map<String, String>> data = $("table#results").rows();
assertThat(data.get(0).get("Status")).isEqualTo("Active");
Acceptance criteria
Locator.rows() added, built on elements()/existing resolve machinery (not a parallel implementation)
Header row detected via th cells (fallback: first tr if no thead/th present — decide and document the exact rule)
Each returned Map is ordered by header column (use LinkedHashMap) with cell text trimmed
Mismatched row/column counts handled without throwing an unrelated exception (define behavior: pad, truncate, or throw LocatorException with a clear message)
Unit tests covering: header-only, missing thead, ragged rows, empty table
Javadoc with a usage example matching the style of the other terminal actions in this file
The acceptance criteria in the issue body cover the behavior we need (header detection, LinkedHashMap ordering, ragged-row handling, tests). Feel free to ask here if anything in the spec is unclear before you start, or open a draft PR early if you want feedback on direction.
Activity
timothytkim commentedon Sep 17, 2026
Hi @shossain786 May I take this issue? Thanks
shossain786 commentedon Sep 17, 2026
Hi @timothytkim - yes, it's yours! Go ahead.
The acceptance criteria in the issue body cover the behavior we need (header detection, LinkedHashMap ordering, ragged-row handling, tests). Feel free to ask here if anything in the spec is unclear before you start, or open a draft PR early if you want feedback on direction.
timothytkim commentedon Sep 17, 2026
Updated on #54 @shossain786