--- id: "7bca4c5c-8581-4760-bdc3-1414276f4c6f" name: "Open SIMbook Button" micro_summary: "How to find and click the \"Open SIMbook\" button — selector collision with Sign Out, reliable text-matching, and click_at_xy pattern." status: "in_progress" see_also: [] scope: "Probing and clicking the \"Open SIMbook\" button on simbook details pages (simnetonline.com/sp/assignments/simbooks/details/#). Covers selector hazards, reliable element identification, coordinate extraction, and the click_at_xy pattern." warnings: "`goto_url()` to the launch href does NOT work — the SIMnet redirect/SSO chain only triggers on a real button click. Always use `click_at_xy()` on the button, never navigate directly to the href." --- ## Page Context Simbook details page: `simnetonline.com/sp/assignments/simbooks/details/11404171` The page lists all sections (Chapter Overview, 4-1, Pause & Practice, Guided Projects, etc.) and has one prominent "Open SIMbook" button that launches the simbook player. ## Button HTML ```html Open SIMbook ``` ## Selector Hazard: `.btn-primary` Collision **`.btn-primary` matches TWO elements on the page:** 1. The "Open SIMbook" launch button (what we want) 2. The "Sign Out" button in the header (what we DON'T want) Querying a single `.btn-primary` gets whichever comes first in the DOM (the Sign Out header button). Never use `querySelector('.btn-primary')` alone. ## Reliable Identification: Text Match `.btn-primary` collision — two elements share this class. Follow the general [[CDP Probing|a895c706-8784-408a-ac2f-99778d65129d]] text-match pattern: iterate all `.btn-primary`, filter by `textContent.trim() === "Open SIMbook"`. ## Click Pattern Use `click_at_xy()` from the [[CDP Probing|a895c706-8784-408a-ac2f-99778d65129d]] text-match pattern. **Must click** — `goto_url(href)` does NOT work (see warnings). ```python click_at_xy(600, 596) wait_for_load() wait(2) # simbook player loads in an iframe, needs extra settle time ``` ## Result Navigates to the simbook player at: ``` simnetonline.com/sb/ac24_ip_04_co?l=2901&a=11404171&t=5&redirect_uri=... ``` The player loads the section content (the first section `ac24_ip_04_co` — Chapter Overview — is opened by default).