Interaction Steps
Click
Simulate mouse click interactions in your test cases
Overview
The Click step simulates mouse click interactions with elements on your web page. It supports various click types and configurations to handle different scenarios like new tab interactions.
Form Fields
Field Name | Type | Required | Description |
---|---|---|---|
Locator | string | Yes | CSS selector or locator for the element to click |
Click Type | dropdown | No | Type of click: Left Click (default), Right Click, or Double Click |
Anticipate Tab | toggle | No | Enable if this click will open a new tab or window |
Form Configuration
Locator Field
- Text input field for entering CSS selectors
- Supports element picker for visual selection
- Provides locator validation and suggestions
Click Type Dropdown
Available options:
- Left Click (default) - Standard mouse click
- Right Click - Context menu click
- Double Click - Double-click interaction
Anticipate Tab Toggle
- Checkbox option to handle new tab/window opening
- When enabled, the test runner will wait for and handle new browser contexts
Examples
Basic Left Click
- Locator:
button[type='submit']
- Click Type: Left Click
- Anticipate Tab: Disabled
Right Click for Context Menu
- Locator:
.context-menu-trigger
- Click Type: Right Click
- Anticipate Tab: Disabled
Click Link Opening New Tab
- Locator:
a[target='_blank']
- Click Type: Left Click
- Anticipate Tab: Enabled
Double Click Action
- Locator:
.editable-text
- Click Type: Double Click
- Anticipate Tab: Disabled
Best Practices
Locator Selection
- Use unique, stable CSS selectors that won’t change with UI updates
- Prefer
data-testid
attributes for better test stability - Avoid overly complex selectors that might break with DOM changes
Click Type Usage
- Use Left Click for standard button/link interactions
- Use Right Click when testing context menus or right-click functionality
- Use Double Click for actions that require double-clicking (like text selection or file opening)
New Tab Handling
- Always enable Anticipate Tab when clicking links with
target="_blank"
- Enable for buttons/elements that trigger
window.open()
- Follow with a Switch Tab step if you need to interact with the new tab
Common Issues
Element Not Clickable
- Ensure the element is visible and not covered by other elements
- Verify the element is not disabled
- Check if the element is within the viewport
Timing Issues
- Add wait conditions before clicking if elements load dynamically
- Use appropriate delays for animations or transitions
New Tab Problems
- Remember to enable Anticipate Tab for links opening new tabs
- Use browser popup blockers might prevent new tabs - test in appropriate environments
Related Steps
- Hover - For hover interactions before clicking
- Switch Tab - For handling new tabs after clicks
- Wait for Element - For waiting on elements before clicking