Skip to content

feat: add Playwright text selector support and use TIMING constants#8

Merged
konard merged 4 commits intomainfrom
issue-7-895bb7f9c584
Dec 28, 2025
Merged

feat: add Playwright text selector support and use TIMING constants#8
konard merged 4 commits intomainfrom
issue-7-895bb7f9c584

Conversation

@konard
Copy link
Member

@konard konard commented Dec 28, 2025

Summary

This PR adopts improvements from https://github.com/konard/hh-job-application-automation (as requested in #7):

  • Add Playwright text selector support: New functions isPlaywrightTextSelector() and parsePlaywrightTextSelector() to properly handle Playwright's :has-text() and :text-is() pseudo-selectors
  • Update normalizeSelector(): Now converts Playwright text selectors to valid CSS selectors for browser context operations
  • Update withTextSelectorSupport(): Extended to handle Playwright text selectors in addition to Puppeteer text selector objects
  • Use TIMING constants: Added NAVIGATION_TIMEOUT constant and updated navigation-manager to use it instead of hardcoded values

Why These Changes

The upstream hh-job-application-automation repository has battle-tested improvements for handling Playwright's text pseudo-selectors. These selectors (:has-text(), :text-is()) are valid for Playwright's locator API but not for document.querySelectorAll. The changes properly normalize these selectors to valid CSS selectors by:

  1. Detecting Playwright text selectors in string format
  2. Parsing out the base selector and text content
  3. Using page.evaluate() to find matching elements
  4. Generating unique CSS selectors (using data-qa attribute or nth-of-type)

Test Plan

  • All 337 unit tests pass
  • ESLint passes with no errors
  • Prettier formatting check passes
  • Pre-commit hooks pass

Fixes #7

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #7
@konard konard self-assigned this Dec 28, 2025
This PR adopts improvements from hh-job-application-automation:

## Changes

### New Playwright text selector support (`selectors.js`)
- Add `isPlaywrightTextSelector()` to detect `:has-text()` and `:text-is()` selectors
- Add `parsePlaywrightTextSelector()` to extract base selector and text content
- Update `normalizeSelector()` to convert Playwright text selectors to valid CSS selectors
- Update `withTextSelectorSupport()` to handle Playwright text selectors in addition to Puppeteer

### Use constants for timing values
- Add `NAVIGATION_TIMEOUT` constant (30000ms) to `constants.js`
- Update `navigation-manager.js` to use `TIMING.NAVIGATION_TIMEOUT`
- Update `bindings.js` to pass `engine` parameter to `normalizeSelector()`

## Why
The upstream hh-job-application-automation repository has battle-tested improvements
for handling Playwright's text pseudo-selectors (`:has-text()`, `:text-is()`) which
are valid for Playwright's locator API but not for `document.querySelectorAll`.
These selectors are now properly normalized to valid CSS selectors.

Fixes #7

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Get latest changes from https://github.com/konard/hh-job-application-automation feat: add Playwright text selector support and use TIMING constants Dec 28, 2025
@konard konard marked this pull request as ready for review December 28, 2025 02:46
konard and others added 2 commits December 28, 2025 03:46
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard
Copy link
Member Author

konard commented Dec 28, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $6.048846 USD
  • Calculated by Anthropic: $3.805937 USD
  • Difference: $-2.242909 (-37.08%)
    📎 Log file uploaded as GitHub Gist (790KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard merged commit 00367b7 into main Dec 28, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get latest changes from https://github.com/konard/hh-job-application-automation

1 participant