fix(linkedin): scroll the real container so profile-read sees Experience and Education (#417) - #465
Open
Agnik47 wants to merge 1 commit into
Open
Conversation
…nce and Education (agentrhq#417) `page.autoScroll()` drives `window.scrollTo`, but LinkedIn's current profile UI scrolls inside `main#workspace`. The window scroller never moves, the lazy loaders for later sections never fire, and `profile-read` exits successfully with empty `experience` and `education` while `profile-experience` returns the same profile's entries. `scrollToSections` now steps the element that actually scrolls — `main#workspace`, else the nearest scrollable ancestor of `main`, else the window — and stops as soon as the requested headings are in the DOM. One `atEnd` round is not the end: LinkedIn lazy-loads on reaching the bottom, so the helper requires two consecutive end rounds with no newly found section. `page.autoScroll()` stays ahead of it for older window-scrolling layouts. The helper never throws: a layout it cannot scroll is not a command failure.
Contributor
🟠 Maintainer review suggested — low confidenceThe automated review could not reach a fully supported conclusion. Limitations
This review is advisory and does not block merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #417.
Cause
profile-readcallspage.autoScroll(), which iswindow.scrollTo(src/browser/dom-helpers.ts:133). LinkedIn's current profile UI scrolls insidemain#workspace, so the window scroller never moves, the lazy loaders for Experience and Education never fire, and the command exits successfully with both fields empty — whileprofile-experiencereturns the same profile's entries.The reporter's read-only inspection matches:
window.scrollYstayed0, and scrollingmain#workspacebrought the headings into the DOM.Fix
plugins/linkedin/shared.jsgainsbuildSectionScrollScript/scrollToSections, following the#workspacepattern already used bypost-comments.js:main#workspace, else the nearest scrollable ancestor ofmain, else the window.atEndround is not the end. LinkedIn lazy-loads on reaching the bottom, so the container grows and the next round has further to travel; the helper requires two consecutive end rounds with no newly found section.profile-read.jskeepspage.autoScroll()ahead of the new call so older window-scrolling layouts are unaffected.Contract
profile-readloads About, Experience, Education, and Featured on amain#workspacelayout.Tests
plugins/linkedin/test/shared-scroll.test.js(new), driving the generated script through JSDOM:main#workspaceis scrolled and the window scroller is not touched.window.scrollTo.atEndis reported at the bottom of the container.atEndround that lazy-loaded a new section, respects the round budget, and returns instead of throwing whenevaluatefails.plugins/linkedin/test/profile-read.test.js: amain#workspacefixture where the sections appear only on the third round now resolves with non-emptyexperienceandeducation, asserting the scroll rounds run before extraction and thatautoScrollis still called.npx vitest run --project plugin plugins/linkedin— 28 files, 260 tests passed.node scripts/check-plugin-pr-scope.mjs upstream/main HEAD— exit 0.npm run check:plugin-parity— OK.Scope
One adapter and one shared helper in the LinkedIn plugin.
autoScrollJsis left alone deliberately: changing the generic scroller would affect every adapter in the repo, and this issue is scoped to the profile layout.