Back to all insights
RPA & Automation 5 min readLast reviewed

Playwright vs Selenium for Healthcare RPA Bots: A Direct Comparison

Why Playwright has replaced Selenium for most healthcare RPA work — auto-waiting, browser contexts, role-based selectors, and when Selenium still makes sense.

The Short Answer

For new healthcare RPA development in 2026, Playwright is the better default. Selenium still makes sense in specific scenarios, but Playwright's architecture solves the failure modes that cause the most production maintenance burden.

First, Check That the Portal May Be Automated

A framework comparison only matters for portals you are permitted to automate. Where a payer offers an X12 transaction or an API for the task, use that instead of either framework.

Check the payer's terms before automating a portal. Several large payers do not allow it. Availity announced in April 2022 that it was ending bot access to Availity Essentials and offers API connections to approved partners instead. The terms of use for the UnitedHealthcare provider portal and Optum prohibit using software to access or scrape their online services, and the Evernorth terms bar robots, scripts and scraping unless Evernorth approves in writing. A bot that breaks a portal's terms puts the practice's portal account at risk. Terms change, so read the current version for each payer; we last read these on 2026-09-29. This is engineering context, not legal advice.

Why Playwright Wins for Payer Portal Automation

1. Auto-waiting Playwright waits automatically for elements to be visible and stable before interacting. Payer portals have loading spinners, dynamic content, and slow AJAX responses. Playwright handles these natively. Selenium requires explicit WebDriverWait calls at every interaction — miss one and the script fails at 3 AM.

2. Browser Context Isolation Playwright's browser context model gives each bot run a clean, isolated state — no shared cookies or sessions between runs. Critical when processing multiple patients sequentially. Selenium requires manual cleanup between sessions.

3. Role-Based Selectors This is the biggest maintenance difference. Playwright's get_by_role() and get_by_label() selectors are semantically stable — they survive portal redesigns. Selenium CSS selectors and XPath break whenever a payer changes their HTML. See the eligibility verification guide for more on selectors.

# Playwright — semantic, survives portal redesigns
await page.get_by_label("Member ID").fill(member_id)
await page.get_by_role("button", name="Verify Eligibility").click()
result = await page.get_by_role("status").inner_text()

# Selenium — fragile, breaks on HTML changes
wait.until(EC.presence_of_element_located((By.ID, "member-id-input")))
driver.find_element(By.ID, "member-id-input").send_keys(member_id)
driver.find_element(By.XPATH, "//button[text()='Verify Eligibility']").click()

4. Async-Native Playwright is async-first in Python and TypeScript. Healthcare bots frequently need to run multiple payers in parallel — Playwright's asyncio support makes this clean. Selenium's threading model is awkward for parallelism.

When Selenium Still Makes Sense

  • Large existing Selenium codebases: A rewrite isn't automatically justified if the bots work
  • Java or C# backends: Playwright's Java support is newer and less mature than Selenium's
  • Existing Selenium Grid infrastructure: If your org already runs it for browser testing, there may be operational reasons to keep RPA in the same ecosystem

HIPAA Considerations Apply to Both

Regardless of which framework you use, the HIPAA architecture requirements are the same — credential storage in Secrets Manager, encrypted compute, immutable audit logs. The framework choice affects maintainability; the HIPAA architecture affects compliance.

The RPA Billing Automation service uses Playwright for portal automation, on portals whose terms allow it or whose payer has approved it in writing.

Related Service

RPA Billing Automation

Deep-dive into our engineering approach, capabilities, and technical specifications.

View Engineering Specs →
SA

Written by Sheharyar Amin

Founder & Lead Engineer, Opexia