Skip to content

feat: expand clickable elements - #131

Merged
nikitachapovskii-dev merged 3 commits into
masterfrom
feat/expand-clickable-elements
Aug 6, 2026
Merged

feat: expand clickable elements#131
nikitachapovskii-dev merged 3 commits into
masterfrom
feat/expand-clickable-elements

Conversation

@nikitachapovskii-dev

@nikitachapovskii-dev nikitachapovskii-dev commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

In Browser mode the Actor now clicks the collapsed elements ([aria-expanded="false"]) before extracting the content, same as WCC. No new input field, and the Raw HTTP mode is unchanged.

Measured on 12 real pages: clicking costs about 0.5 s on pages that have collapsed elements and ~7 ms on pages that don't.

Closes #112

@nikitachapovskii-dev nikitachapovskii-dev self-assigned this Aug 3, 2026
@nikitachapovskii-dev
nikitachapovskii-dev force-pushed the feat/expand-clickable-elements branch from c513712 to 05bb640 Compare August 3, 2026 10:22
@nikitachapovskii-dev
nikitachapovskii-dev marked this pull request as ready for review August 3, 2026 13:32

@ruocco-l ruocco-l left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will be pre-approving because I think it's correct, but let's all agree that this is a no-opt, non-customizable feature for the user. Some pages (it happened in WCC but I can't seem to find the issue related to it) may be broken by clicking (because they cause navigation) de facto making it impossible to scrape them with headless browser on RAG

Comment thread src/request-handler.ts
Comment on lines +263 to +267
if (page) {
await expandClickableElements(page, CLICK_ELEMENTS_CSS_SELECTOR);
addTimeMeasureEvent(request.userData, 'playwright-expand-clickable-elements');
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you move this up, before the wait for dynamic content function, you don't have to add a synthetic wait

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked with scripts to measure: on real pages (3 runs each): clicking before the wait loses content: openai.com −785 chars, github.com −422

Before the wait the page usually isn't hydrated (we go with domcontentloaded), so the collapsed elements have no click listeners yet, or don't exist at all.

Comment thread actors/apify_rag-web-browser/README.md Outdated
Comment on lines +248 to +250
Note that clicking costs about half a second on pages that have such elements, and that content of
expanded navigation menus can end up in the output as well.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't have a way to set it off, so there is no use in saying this

@nikitachapovskii-dev
nikitachapovskii-dev merged commit 9a001c5 into master Aug 6, 2026
2 checks passed
@nikitachapovskii-dev
nikitachapovskii-dev deleted the feat/expand-clickable-elements branch August 6, 2026 13:49
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.

Expand clickable elements (in browser mode)

4 participants