79160723

Date: 2024-11-05 21:26:04
Score: 1
Natty:
Report link

thank you all for your contributions! I am quite new to all of this, but a way around it was using another Playwright function that allowed to manipulate the HTML string to match the text. So, instead of using :text-matches I used inner_text()

Please find the code snippet that was modified below:

while names_to_find:
    # Get all <tr> elements in the table body
    rows = page.locator("table tbody tr")

    # Iterate over each row in the table
    for i in range(await rows.count()):
        # Get the name in lowercase
        name_unit = await rows.nth(i).locator('td[data-label="nameunit"]').inner_text()
        name_unit_lower = name_unit.strip().lower()
Reasons:
  • Blacklisted phrase (0.5): thank you
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Sofía Fayó