Why this is tricky

Two ways layout betrays a position-based locator: items that reorder between loads, and content that gets inserted above something you were about to click. Both are solved the same way โ€” locate by a stable attribute, and act on an element handle rather than a screen coordinate.

1. Reordering list

Same five items, shuffled into a new order every reload. "Select Charlie" only works if you locate by text/data attribute, not by position.


    2. Layout-shifting banner

    Clicking "Load content" inserts a banner above the button below after a short delay, pushing it down. Click it anyway โ€” the element handle stays valid even though its screen position moved.

    Initial state.