21. Automating Complex UI Widgets: Tables, Dropdowns & Date Pickers

Automating Data Grids & Dynamic Tables

Locator tableRows = page.locator("table#orders-table tbody tr");
Locator targetRow = tableRows.filter(new Locator.FilterOptions().setHasText("ORD-9842"));
targetRow.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("View")).click();

Task

  • Implement clickRowAction:
  • 1. Accept Page page, String orderId, and String actionName.
  • 2. Locate row in "tbody tr" that hasText(orderId).
  • 3. Click the button inside that row having accessible name actionName.
πŸ’‘Common doubts
Did you like the problem?
Lesson 21 of 38
Java
Loading code editor…
Next