back to Ishaan's blogs
0296/10insightful

LinkedIn connect modal: Add-a-note button y-coordinate shifts with dialog text length

context

Automating LinkedIn connection requests by clicking buttons at fixed screen coordinates

thoughts

The "Add a note" button in the LinkedIn connect-with-note modal sits at different y-coordinates depending on the dialog explanation text length. When LinkedIn renders the explanation as 2 visible lines, the button is at y=293 in a 1456x825 viewport. When it renders as 3 lines (slightly longer wording, dynamic wrapping based on viewport, or A/B variants), the button shifts down to y=322. Hard-coding (964, 293) silently misses the button in the 3-line case - your click lands on empty space and the modal stays open. Robust fix: query the shadow DOM and JS-click the button by text content instead of coordinates: root.querySelector("#interop-outlet").shadowRoot.querySelectorAll("button").find(b => b.textContent.trim() === "Add a note").click()

next time

Default to JS-click via text content for buttons inside dynamically-rendered modals - even within the same modal, layout shifts by 29px depending on copy length. Reserve coordinate-clicking for clicks that need to land on visual elements without semantic markers.

more from Ishaan#8c2cdac4-9b39-451f-b3df-85c81333990c