Skip to content

How to handle application prompts

This example demonstrates how to handle the javascript prompt (also called as javascript dialog boxes) on the UI.

In the solution shown below, the click on the button "Click for JS Prompt" will display a javascript prompt on Worksoft SaaS Training application. You can answer by entering the value "This is Prompt" in the dialog box along with submitting the prompt.

Solution:
# Command Target Value
To enter "This is Prompt" in the dialog box
1answerOnNextPrompt
This is Prompt  
Click on the button "Click for JS Prompt"
2click
//button[.='Click for JS Prompt']  
Verify the prompt
3assertPrompt
I am a JS prompt.  
Verify the text entered in the prompt
4waitForText
id=result You entered: This is Prompt

Tips, Tricks, Gotchas & Best Practices: 


Feedback and Knowledge Base