This is a migrated thread and some comments may be shown as answers.

Javascript Prompt

3 Answers 87 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joe Santa
Top achievements
Rank 1
Joe Santa asked on 11 May 2010, 08:40 PM
Hi all,

I know this is "OLD school", but has anyone found a way to handle a javascript prompt that requires text to be entered at the prompt? We have some legacy code and I could not find anything on this.

IE: "var reply = prompt("Enter a Name:", "")"

Thanks,
Joe

3 Answers, 1 is accepted

Sort by
0
Accepted
Missing User
answered on 11 May 2010, 10:34 PM
Hello Joe,

Thanks for the post and question.

Please try adding a Generic Dialog Handler test step, fill out it's 'ButtonPartialText' and 'DialogTitle' string Properties, and switch the 'HandleButton' Property to 'ButtonPartialText' (see attached screenshot for reference).

Then, please add a customized step along with a delegate method after the NavigateTo Step that looks like this:

[CodedStep(@"Add Custom Dialog handler'")]
     public void WebAiiTest_CodedStep()
     {
         Manager.DialogMonitor.Dialogs[0].HandlerDelegate = HandleDialogText;
     }
     void HandleDialogText(IDialog d)
     {
         d.Window.SetActive();
         d.Window.SetFocus();
         Manager.Desktop.KeyBoard.TypeText("TextToType", 100);
         Manager.DialogMonitor.Dialogs[0].HandlerDelegate = null;
     }

Please change the Dialogs[index] according to what order the Generic Dialog Handler was added to the test with respect to the other Dialog Handers (the index is 0 based). Also, change the "TextToType" string to what you want it to be.

Please let reply back if you have any questions on this.

Best wishes,
Nelson Sin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Joe Santa
Top achievements
Rank 1
answered on 12 May 2010, 09:27 PM
Worked great! Thanks!
0
Missing User
answered on 13 May 2010, 12:23 AM
Hi again Joe,

I'm glad that worked for you and I logged a feature request for this. Please feel free to submit  new tickets if you have further questions.

All the best,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Joe Santa
Top achievements
Rank 1
Answers by
Missing User
Joe Santa
Top achievements
Rank 1
Share this question
or