⚡ Actions — All User Interactions
Actions — All User Interactions: Selenium's Actions API is the Builder pattern applied to browser gestures: instead of sending commands one by one, you chain moves together and d
Selenium's Actions API is the Builder pattern applied to browser gestures: instead of sending commands one by one, you chain moves together and dispatch the whole sequence with a single .perform() — just like appending to a Java StringBuilder and calling toString() at the end. But if element.click() already exists, why does a separate Actions API need to exist? Because certain UI components react to the full chain of real mouse events (mouseover, mousedown, mouseup), not just the click event — tooltips, drag-and-drop widgets, and context menus all fall into this category. element.click() tells the browser to simulate a click but skips intermediate events that those components rely on. In Java you start with new Actions(driver); in Python it is ActionChains; in TypeScript/Playwright it is page.mouse — same concept, different syntax. The QA trap to watch for: a drag-and-drop test written with element.click() appears to "work" locally, but in staging the real JavaScript event listeners kick in and the test returns a silent false PASS — no failure, no exception, just wrong results shipped to production.
1. Basic Actions (Click, Type, Clear, Submit)
Java — Basic Actions
Micro Lab: Selenium — Locator selection
Replace the TODO line with the critical line from the expected solution. This is not a real runtime; the goal is to reinforce writing the correct structure in a controlled way.
Step by Step: What isDisplayed/isEnabled/isSelected Actually Ask
isDisplayed() asks about render state
Even if the element EXISTS in the DOM, `isDisplayed()` returns FALSE when `display:none` or `visibility:hidden` applies — existence and visibility are DIFFERENT things.
isEnabled() asks about interaction state
A button CAN be visible but if it carries a `disabled` attribute, `isEnabled()` returns FALSE — calling click() would do NOTHING.
isSelected() is meaningful only for certain types
It answers "is it checked?" for checkboxes, radios, and options — for a ` ` it always returns FALSE.
Why check all three TOGETHER?
Checking all three BEFORE clicking a submit button in production turns silent failures like "the button exists but is disabled" into a test ASSERTION.