Hi,
I am unable to perform field level validation , since whenever I use SetValue(string property, string input) method, it enters all the values in the input text box.
For example:
I have a input text box that is restricted to two digit numeric values but when i use the SetValue(string property, string input) method and pass a 3 digit number, it allows to enter 3 digit number. I cross verified manually, the input text box takes only 2 digit value but through the testing framework it enters 3 digit number.
Please let me know how to fix this?
I am unable to perform field level validation , since whenever I use SetValue(string property, string input) method, it enters all the values in the input text box.
For example:
I have a input text box that is restricted to two digit numeric values but when i use the SetValue(string property, string input) method and pass a 3 digit number, it allows to enter 3 digit number. I cross verified manually, the input text box takes only 2 digit value but through the testing framework it enters 3 digit number.
Please let me know how to fix this?
7 Answers, 1 is accepted
0
Hi,
Thank you for contacting Telerik support.
Please instead of SetValue try to set focus on the input, perform a click on it and type the digits as a desktop commands. This will simulate a real typing.
Let me know whether that helps.
Regards,
Boyan Boev
Telerik
Thank you for contacting Telerik support.
Please instead of SetValue try to set focus on the input, perform a click on it and type the digits as a desktop commands. This will simulate a real typing.
yourElement.Focus();
yourElement.MouseClick();
Manager.Desktop.KeyBoard.TypeText(
"19"
, 50, 100);
Let me know whether that helps.
Regards,
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0
Vishal
Top achievements
Rank 1
answered on 27 Feb 2014, 10:21 AM
Hi
Thanks for the reply.
I will check and let you know
Thanks for the reply.
I will check and let you know
0
Hello Vishal,
Thank you!
Hope to hear from you soon.
Regards,
Boyan Boev
Telerik
Thank you!
Hope to hear from you soon.
Regards,
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0
Vishal
Top achievements
Rank 1
answered on 27 Feb 2014, 02:30 PM
Hi
The below code is able to perform the required operation but the only problem I am having is how should I clear the default value.
yourElement.Focus();
yourElement.MouseClick();
Manager.Desktop.KeyBoard.TypeText("19", 50, 100);
For example : The input text field is restricted to 2 digits and by default the field has value as 0. Now I want to remove the default value and then enter the new value 45. With the above code if I try to enter 45, it will take the value as 05. Please let me know how to fix this
The below code is able to perform the required operation but the only problem I am having is how should I clear the default value.
yourElement.Focus();
yourElement.MouseClick();
Manager.Desktop.KeyBoard.TypeText("19", 50, 100);
For example : The input text field is restricted to 2 digits and by default the field has value as 0. Now I want to remove the default value and then enter the new value 45. With the above code if I try to enter 45, it will take the value as 05. Please let me know how to fix this
0
Hi Vishal,
You can use either an additional row of code which will press 2 times backspace:
or you can try it with set value to "".
Note that you should add assembly reference to System.Windows.Forms for the first case.
Hope this helps.
Regards,
Boyan Boev
Telerik
You can use either an additional row of code which will press 2 times backspace:
yourElement.Focus();
yourElement.MouseClick();
Manager.Desktop.KeyBoard.KeyPress(Keys.Back, 100, 2);
Manager.Desktop.KeyBoard.TypeText("19", 50, 100);
or you can try it with set value to "".
Note that you should add assembly reference to System.Windows.Forms for the first case.
Hope this helps.
Regards,
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0
Vishal
Top achievements
Rank 1
answered on 04 Mar 2014, 12:58 PM
Hi Boyan,
Thanks for the reply. I went with the second approach. It worked
Thanks a lot
Thanks for the reply. I went with the second approach. It worked
Thanks a lot
0
Hi Vishal,
Glad to hear that!
Let us know if you need further assistance.
Regards,
Boyan Boev
Telerik
Glad to hear that!
Let us know if you need further assistance.
Regards,
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings