Context Click (Right Mouse Click)
#
PurposeThis action performs a context click (right click) on a specified web element using its properties. It is useful for opening context menus or triggering specific actions associated with a right-click.
#
Scenarios#
Scenario 1#
TitlePerform a right-click on the button
Sample test case: TEST-8013 Perform Right-Click on the Button
#
Scenario OverviewA user needs to open a context menu by right-clicking on a button. This scenario demonstrates the use of the "right-click" action to trigger a specific response or behavior, such as displaying a message box.
#
Steps to Follow- Open a webpage that contains a button.
- Identify the button using its attribute.
- Perform the "right click" action on the text of the button.
- Verify that the right-click action has been successfully performed on the button.
#
ActionsParameter | Type | Value |
---|---|---|
text | element parameter | Right Click Me |
right click | selenium action | right click |
#
Expected Result- The right-click action successfully clicks the button and displays a text message.
#
Common Errors and FixesError: The message is not displayed.
- Fix: Ensure that the correct attribute (e.g.,
id
ortext
) is provided and that the button is interactable.
- Fix: Ensure that the correct attribute (e.g.,
Error: The "right-click" action does not trigger the message.
- Fix: Ensure the row is interactable and that right-click functionality is supported.
#
Test Cases#
Test Case for Scenario 1#
ObjectiveEnsure that the "right-click" action is performed on the button identified by its text attribute.
#
Steps to Perform- Open a browser and navigate to a webpage containing a button.
- Use the action with following inputs:
- Input parameters:
- Element parameter: Provide the element's attribute (e.g.,
text = Right Click Me
). - Selenium action:
right click
- Element parameter: Provide the element's attribute (e.g.,
- Input parameters:
- Verify that the message appears.
#
Expected Outcome- The message is displayed when the button is clicked.
#
Additional Tips for this Action- Use a unique parent or sibling element to narrow the search scope when identifying duplicate elements.
- Enable the Allow Hidden option to interact with hidden elements.
- Test the action across multiple browsers to ensure compatibility.
#
Error Handling for Context Click (Right Mouse Click)#
Common Problems and Their FixesProblem: The element is not found.
Possible Cause: The attribute is incorrect, or the element is outside the viewport.
How to Fix:- Ensure the attribute matches the element.
- Scroll to bring the element into view.
Problem: The "right-click" action fails.
Possible Cause: The element is not interactable or is being blocked by another element.
How to Fix: Use the allow hidden or use JS option to force interaction.Problem: The message does not appear.
Possible Cause: The "right-click" action is not associated with the element.
How to Fix: Verify that the element supports message interactions.