Overview
The Click step simulates mouse click interactions with elements on your page. Whether you’re clicking buttons, links, icons, or any interactive element, Click handles standard clicks, right-clicks, and double-clicks to test all your user interactions.When to Use Click
Use Click when you need to:- Submit forms: Click submit buttons to process form data
- Navigate: Click links to move between pages or trigger navigation
- Trigger actions: Click buttons that open modals, start processes, or change UI state
- Interact with custom controls: Click tabs, toggles, cards, or custom UI components
- Access context menus: Right-click to test context menu functionality
How It Works
Click finds an element using a CSS selector and simulates a mouse click on it. The step triggers all the same events a real user click would - mousedown, mouseup, click - making it work with both native HTML elements and JavaScript-powered interactive components. You can choose between left click (standard), right click (for context menus), or double-click (for actions that require two quick clicks). The step works with any clickable element, whether it’s a button, link, div with click handlers, or custom component.Using the Click Step
When you add a Click step, you’ll configure:Finding Your Element
Use the element picker to visually select the element you want to click, or enter a CSS selector directly. Make sure your selector targets the actual clickable element, not a wrapper or parent container.Choosing Your Click Type
Left Click (Default) The standard mouse click. Use this for buttons, links, and most interactive elements. Right Click Simulates a context menu click. Perfect for testing right-click menus or custom context actions. Double Click Two quick clicks in succession. Use for actions that require double-clicking like selecting text, opening files, or triggering special behaviors.Anticipate New Tab
Enable this when your click is expected to open a new browser tab or window (e.g., links withtarget="_blank"). When turned on, Supatest prepares the automation context to capture and attach to the new tab reliably after the click.
- Use together with a subsequent Switch Tab step
- Helps avoid flakiness from popup blockers or race conditions
- Recommended for marketing/help links or any action that opens an external page
Real-World Examples
Submitting a Login Form
Opening a Modal Dialog
Testing Context Menu
Double-Click to Edit
Navigating Through Tabs
Clicking Link That Opens New Tab
Best Practices
Write Stable Selectors
- Target clickable elements with unique attributes:
button[data-action='save'] - Use
data-testidattributes for test stability:[data-testid='submit-button'] - Avoid brittle selectors based on layout:
div:nth-child(3) > button:first-child
Choose the Right Click Type
- Use Left Click for 99% of interactions (buttons, links, cards, icons)
- Use Right Click specifically for context menu testing
- Use Double Click only when your UI genuinely requires double-clicking
Ensure Elements Are Clickable
- The element must be visible in the viewport
- Nothing should cover or overlap the clickable element
- The element shouldn’t be disabled
- For dynamically loaded elements, add Wait for Element first
Verify Click Results
Always add verification after clicks to confirm the action worked:- Use Check Visibility to verify modals or content appears
- Use Check URL to confirm navigation happened
- Use Check Text to verify UI updates correctly
Handling New Tabs Reliably
- Enable Anticipate New Tab on Click steps that open new tabs/windows
- Always follow with a Switch Tab step to make the new tab active
- Prefer stable selectors on the link/button that opens the tab
Troubleshooting
Element Not Clickable
Symptom: Test fails saying element can’t be clicked Solution:- Verify the element is visible using browser dev tools
- Check if another element overlays the target (modals, popups, loading screens)
- Ensure the element isn’t disabled (check for
disabledattribute) - Add Wait for Element if the element loads dynamically
- Scroll the element into view if it’s below the fold
Click Doesn’t Do Anything
Symptom: Click succeeds but expected action doesn’t happen Solution:- Verify you’re clicking the correct element (use element picker to confirm)
- Check if the element needs to be hovered first
- Look for JavaScript errors in the browser console
- Ensure required preconditions are met (logged in, form filled, etc.)
- Check if the element has event listeners attached (some require page load)
Wrong Element Gets Clicked
Symptom: Test clicks a different element than intended Solution:- Make your selector more specific to target the exact element
- Check if multiple elements match your selector
- Use the element picker to generate a precise selector
- Add unique
data-testidattributes to elements in your app
Timing Issues
Symptom: Click runs before the element is ready Solution:- Add Wait for Element before the click
- Wait for loading indicators to disappear
- Ensure animations complete before clicking
- For single-page apps, wait for page transitions to finish
New Tab Not Opening
Symptom: Links withtarget="_blank" don’t open new tabs
Solution:
- Verify the link has
target="_blank"attribute - Check browser popup settings aren’t blocking new tabs
- Enable Anticipate New Tab on the preceding Click step
- Add Switch Tab after clicking to interact with the new tab
- Test manually to confirm the link works outside of automation
Related Steps
- Hover - Hover over elements before clicking (for hover-dependent UI)
- Double Click - Use Double Click type for double-click actions
- Wait for Element - Wait for elements before clicking
- Check Visibility - Verify click results appeared
- Switch Tab - Handle new tabs opened by clicks

