Javascript Prompt

4 posts, 1 answers
  1. Joe Santa
    Joe Santa avatar
    6 posts
    Member since:
    Apr 2010

    Posted 11 May 2010 Link to this post

    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
  2. Answer
    Missing user
    Missing user avatar

    Posted 11 May 2010 Link to this post

    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.
  3. Joe Santa
    Joe Santa avatar
    6 posts
    Member since:
    Apr 2010

    Posted 12 May 2010 Link to this post

    Worked great! Thanks!
  4. Missing user
    Missing user avatar

    Posted 12 May 2010 Link to this post

    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.
Back to Top