Speed up filling in a Webform

Ask general questions here.
Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Speed up filling in a Webform

Post by Todor » Tue Jul 26, 2011 11:25 am

Hi,

Is it possible to speed up the filling in of a Webform with Ranorex? If it is, can you please tell me how?

Regards
Konstantin Todor

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Speed up filling in a Webform

Post by Support Team » Tue Jul 26, 2011 1:54 pm

Hi,

There are a few possibilities:
* You can directly set the values on input tags (e.g. text boxes, myTextBox.Value = "yourvalue";)
* Otherwise, when using the Keyboard you can reduce the Keyboard.KeyPressTime (see this forum thread)
* If you are using Recorder, you can reduce the Durations on each item to a low value or zero; or use Turbo Mode
* Make sure that the Ranorex IE addin is enabled, and that IE Protected Mode is turned off (requires reboot)

Michael
Ranorex Team
.
Image

Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Re: Speed up filling in a Webform

Post by Todor » Tue Jul 26, 2011 2:06 pm

That means when i have a repository item for a inputbox i can set the value by usercode?
For example:

Code: Select all

//First I define the Repository:
WebTestRepository input = WebTestRepository.Instance;

//And then I select the Item and set the value:
input.Form.Lastname.Value="test";
Or is this incorrect? (Sorry I am not a big fan of C#)

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Speed up filling in a Webform

Post by Support Team » Tue Jul 26, 2011 2:14 pm

You can use the SetValue action in Recorder (just drag the repository item to the action list and select "set value").
The code looks quite ok. If you have an appfolder with name "MyWebsite" and a folder named "Form" with an input tag "LastName" then the code looks like this:
var repo = WebTestRepository.Instance;
repo.MyWebsite.Form.LastName.Value = "Blub";
You might also want to have a look at the generated code-behind.

Cheers,
Michael
.
Image

Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Re: Speed up filling in a Webform

Post by Todor » Tue Jul 26, 2011 2:45 pm

Thank you for your quick and good advice :)

Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Re: Speed up filling in a Webform

Post by Todor » Tue Jul 26, 2011 3:36 pm

I now have a problem concerning the valuesetting. I tried it as you said by dragging the repository item to the action list. I set the value on every single item but it did not fill anything in. The Paths are 100% correct and I dont get it, why it wouldn't work.

Code: Select all

 
try {
        Report.Log(ReportLevel.Info, "Set Value", "(Optional Action)\r\nSetting 
        attribute text  to  '$Companyname' on item 'Servicedesk.Form.Companyname'.",
        repo.Servicedesk.Form.CompanynameInfo, new RecordItemIndex(3));
        repo.Servicedesk.Form.Companyname.Element.SetAttributeValue("text", 
        Companyname);
      }
catch(Exception ex) {
                                  Report.Warn("(Optional Action) " + ex.Message);
                              }
            
try {
        Report.Log(ReportLevel.Info, "Set Value", "(Optional Action)\r\nSetting 
        attribute text to '$Department' on item 'Servicedesk.Form.Department'.",
        repo.Servicedesk.Form.DepartmentInfo, new RecordItemIndex(4));
        repo.Servicedesk.Form.Department.Element.SetAttributeValue("text", 
        Department);
     }
 catch(Exception ex) {
                                  Report.Warn("(Optional Action) " + ex.Message);
                               }
            
try {
        Report.Log(ReportLevel.Info, "Set Value", "(Optional Action)\r\nSetting 
        attribute text to '$Telephonenumber' on item 'Servicedesk.Form.Telephonenumber'.", 
        repo.Servicedesk.Form.TelephonenumberInfo, new RecordItemIndex(5));
        repo.Servicedesk.Form.Telephonenumber.Element.SetAttributeValue("text", 
        Telephonenumber);
     } 
catch(Exception ex) {
                                  Report.Warn("(Optional Action) " + ex.Message);
                              }
            
try {
         Report.Log(ReportLevel.Info, "Set Value", "(Optional Action)\r\nSetting
         attribute text to '$Faxnumber' on item 'Servicedesk.Form.Faxnumber'.",         
         repo.Servicedesk.Form.FaxnumberInfo, new RecordItemIndex(6));
         repo.Servicedesk.Form.Faxnumber.Element.SetAttributeValue("text", 
         Faxnumber);
     }
 catch(Exception ex) {
                                   Report.Warn("(Optional Action) " + ex.Message);
                               }
            
try {
          Report.Log(ReportLevel.Info, "Set Value", "(Optional Action)\r\nSetting
          attribute text to '$Email' on item 'Servicedesk.Form.Email'.",
          repo.Servicedesk.Form.EmailInfo, new RecordItemIndex(7));
          repo.Servicedesk.Form.Email.Element.SetAttributeValue("text", Email);
      } 
catch(Exception ex) {
                                 Report.Warn("(Optional Action) " + ex.Message);
                               }
            
try {
          Report.Log(ReportLevel.Info, "Set Value", "(Optional Action)\r\nSetting
          attribute text to '$Adress' on item 'Servicedesk.Form.Adress'.",
          repo.Servicedesk.Form.AdressInfo, new RecordItemIndex(8));
          repo.Servicedesk.Form.Adress.Element.SetAttributeValue("text", Adress);
     }  
catch(Exception ex) {  
                                  Report.Warn("(Optional Action) " + ex.Message);
                              }
            
try {
          Report.Log(ReportLevel.Info, "Set Value", "(Optional Action)\r\nSetting
          attribute text to '$PLZ' on item 'Servicedesk.Form.PLZ'.",
          repo.Servicedesk.Form.PLZInfo, new RecordItemIndex(9));
          repo.Servicedesk.Form.PLZ.Element.SetAttributeValue("text", PLZ);
     }
catch(Exception ex) {
                                   Report.Warn("(Optional Action) " + ex.Message);
                              }
Edit: The Variables are working too.
Attachments
NoError.png
NoError.png (66.63 KiB) Viewed 829 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Speed up filling in a Webform

Post by Support Team » Wed Jul 27, 2011 8:42 am

Hi,
Todor wrote:I now have a problem concerning the valuesetting. I tried it as you said by dragging the repository item to the action list. I set the value on every single item but it did not fill anything in. The Paths are 100% correct and I dont get it, why it wouldn't work.
If you execute your recording, do you get any error in your Report?
Are you trying to set the text on a Container element or on a Text element?
Would it be possible to post us a Ranorex Snapshot of the entire grid?
How to create a Ranorex Snapshot

Did you read the User Guide already? If not I would suggest it, because we describe almost every functionality inside this Guide.
http://www.ranorex.com/support/user-guide-20.html

Regards,
Peter
Ranorex Team
.
Image

Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Re: Speed up filling in a Webform

Post by Todor » Wed Jul 27, 2011 11:17 am

I have already fixed this problem. I used the User Code alternative. I have also already read your User guide ;)