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

How to submit in HtmlInputText?

3 Answers 98 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.
Christian Skovgaard
Top achievements
Rank 1
Christian Skovgaard asked on 16 Oct 2009, 12:03 PM
Hello Telerik,

In our product we have various input fields. When I try to automate the renaming of a file, the WebUi Test correctly records the text typed (Set 'input_text_Inputfield' text to 'renamed.png') but for the renaming to take effect the user must press 'return'.

The pressing of the return key is not recorded by the WebUi Test and I can find no Desktop Action for it. If I try to convert to code I get the following:

 {

            // Set 'input_Text_Inputfelt' text to 'renamed.png'
            HtmlInputText input_Text_Inputfelt = Pages.Dynamicweb_7__Dynamicweb_administration_0.Frame_right.input_Text_Inputfelt;
            input_Text_Inputfelt.Wait.ForExists(10000);
            input_Text_Inputfelt.Text = "renamed.png";

  }
  
Is there a way to conclude this code with a 'return', 'submit' or something?

Kind regards
Christian

3 Answers, 1 is accepted

Sort by
0
Accepted
Missing User
answered on 16 Oct 2009, 03:00 PM
Hello Christian,

If you could please try adding the following to the end of the generated code:

input_Text_Inputfelt.MouseClick(ArtOfTest.WebAii.Core.MouseClickType.LeftClick);  
System.Threading.Thread.Sleep(1000);  
ActiveBrowser.Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Return);  
ActiveBrowser.WaitUntilReady();

If KeyPress() does not work, please try ActiveBrowser.Manager.Desktop.KeyBoard.SendString("{Enter}"); instead.

It is a little odd that the keystroke is not recorded. Is there a public website that you are seeing this on? Or is your text box using some sort of Ajax/Javascript, like AutoComplete?

Regards,
Nelson Sin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Christian Skovgaard
Top achievements
Rank 1
answered on 19 Oct 2009, 07:32 AM
Hi Nelson,

The SendString method worked.

We are trying to use WebUITest to record in the backend of our Content Management System, so it will surely meet some strange code. I think this was some kind of custom javascript control.

Kind Regards
Christian
0
Missing User
answered on 19 Oct 2009, 03:17 PM
Hello again Christian,

I'm glad it worked for you. Thanks for the info, and if there is custom javascript, then it maybe intercepting the Enter keystroke before it is recorded by WebUI. I'll look to try to test it out in the next version of WebUI. If you haven't tried already, please try the recording in the remote recording browser to see if the keystroke records correctly there.

Greetings,
Nelson
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Christian Skovgaard
Top achievements
Rank 1
Answers by
Missing User
Christian Skovgaard
Top achievements
Rank 1
Share this question
or