Article Overview:
This article will cover how you can achieve the following:
- Capture and validate the text of native alert messages displayed during journey execution.
- Use extensions and JavaScript to handle and verify alert messages.
Problem Statement:
Users want to capture and validate the text displayed in native browser alerts during specific actions in their journeys. Standard approaches may not work due to the ephemeral nature of alert messages.
Solution:
Solution I: Using outer HTML
Capture the page's HTML, including certain alert-related content, using:
- This captures the entire HTML content, which can include alert-related details under certain conditions.
Solution II: Using alertcheck()
Extension
Code:
The alertcheck(path)
extension overrides the browser's native alert
function to capture and return the alert message.
Example:
Reference Screenshot:
Steps to Use:
- Use the
alertcheck(path)
extension in your journey. - Provide the appropriate
path
to the button or element triggering the alert. - The captured alert message is returned and can be stored for further validation.
Solution III: Inline Extension
Code:
This inline script captures the alert message and stores it in a global variable for later retrieval.
-
Override the
alert
Function: -
Trigger the Alert:
3. Retrieve the Alert Message:
Execute "return window.alertMessage" returning $alertMessage
Comments
0 comments
Please sign in to leave a comment.