Hello
Could you, please, clarify how to set empty value into RadDatePicker?
Recorded step "RadInput: value '' entered." does not clear the field.
When I converted the step into Codded step, I get the following compilation error:
--------------------------------------------------
c:\Users\Documents\WebUI Test Studio Projects\Proj\New Test.aii.cs: Line 77: (CS1061) 'ArtOfTest.WebAii.Controls.HtmlControls.HtmlSpan' does not contain a definition for 'TypeText' and no extension method 'TypeText' accepting a first argument of type 'ArtOfTest.WebAii.Controls.HtmlControls.HtmlSpan' could be found (are you missing a using directive or an assembly reference?)
Thanks,
Svetlana
Could you, please, clarify how to set empty value into RadDatePicker?
Recorded step "RadInput: value '' entered." does not clear the field.
When I converted the step into Codded step, I get the following compilation error:
--------------------------------------------------
c:\Users\Documents\WebUI Test Studio Projects\Proj\New Test.aii.cs: Line 77: (CS1061) 'ArtOfTest.WebAii.Controls.HtmlControls.HtmlSpan' does not contain a definition for 'TypeText' and no extension method 'TypeText' accepting a first argument of type 'ArtOfTest.WebAii.Controls.HtmlControls.HtmlSpan' could be found (are you missing a using directive or an assembly reference?)
Thanks,
Svetlana
12 Answers, 1 is accepted
0
Hello Svetlana,
I am not sure why you receive such an error as I cannot reproduce it when I convert typing action to code. Can you replicate the error if you record a typing step on this example and convert it to code?
Generally speaking if you need to clear the value of a RadInput control, in order for your approach to work the control must have its SelectionOnFocus property set to "SelectAll". This will ensure that any typing inside the control will delete the old value.
Another approach is to use the Clear() method from the RadInput wrapper's API:
I hope this helps.
Greetings,
Pavel
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.
I am not sure why you receive such an error as I cannot reproduce it when I convert typing action to code. Can you replicate the error if you record a typing step on this example and convert it to code?
Generally speaking if you need to clear the value of a RadInput control, in order for your approach to work the control must have its SelectionOnFocus property set to "SelectAll". This will ensure that any typing inside the control will delete the old value.
Another approach is to use the Clear() method from the RadInput wrapper's API:
[CodedStep(@
"RadInput: clear input value."
)]
public
void
ClearInputValue()
{
this
.Find.ById<RadDatePicker>(
"RadDatePicker1_wrapper"
).DateInput.Clear();
}
I hope this helps.
Greetings,
Pavel
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

Svetlana
Top achievements
Rank 1
answered on 07 Jun 2010, 03:01 PM
Thank you Pavel,
I've tried to use Clear() method:
[CodedStep(@"RadInput: value '0' entered.")]
public void Test_CodedStep44()
{
this.Find.ById<RadDatePicker>("PickerExpireDateDateInputWrapper").DateInput.Clear();
}
but got the following compilation error:
c:\Users\Documents\WebUI Test Studio Projects\Proj\Test.aii.cs: Line 549: (CS0104) 'RadDatePicker' is an ambiguous reference between 'Telerik.WebAii.Controls.Html.RadDatePicker' and 'Telerik.WebAii.Controls.Xaml.RadDatePicker'
The same error I've got for the control from page http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/custompopup/defaultcs.aspx
---
Coded step with TypeText("") expression for control from http://demos.telerik.com page was compiled successfully.
Could you, please, help me with Clear() method and give an example how to set some date into RadDatePicker control?
Thank you in advance :)
I've tried to use Clear() method:
[CodedStep(@"RadInput: value '0' entered.")]
public void Test_CodedStep44()
{
this.Find.ById<RadDatePicker>("PickerExpireDateDateInputWrapper").DateInput.Clear();
}
but got the following compilation error:
c:\Users\Documents\WebUI Test Studio Projects\Proj\Test.aii.cs: Line 549: (CS0104) 'RadDatePicker' is an ambiguous reference between 'Telerik.WebAii.Controls.Html.RadDatePicker' and 'Telerik.WebAii.Controls.Xaml.RadDatePicker'
The same error I've got for the control from page http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/custompopup/defaultcs.aspx
---
Coded step with TypeText("") expression for control from http://demos.telerik.com page was compiled successfully.
Could you, please, help me with Clear() method and give an example how to set some date into RadDatePicker control?
Thank you in advance :)
0
Hello Svetlana,
You probably don't need the Silverlight (XAML) reference, do you? You can delete it from the using statements at the top of the code page or just reference the HTML version full type:
<Telerik.WebAii.Controls.Html.RadDatePicker>
Let us know if you need further assistance.
Kind regards,
Konstantin Petkov
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.
You probably don't need the Silverlight (XAML) reference, do you? You can delete it from the using statements at the top of the code page or just reference the HTML version full type:
<Telerik.WebAii.Controls.Html.RadDatePicker>
Let us know if you need further assistance.
Kind regards,
Konstantin Petkov
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

Svetlana
Top achievements
Rank 1
answered on 07 Jun 2010, 03:18 PM
Thank you Konstantin,
Now I can run the test, but the step with Clear() method is failed with the following error:
InnerException:
System.NullReferenceException: Object reference not set to an instance of an object.
at TestProject1.New_Test_1_.New_Test1_CodedStep() in c:\Users\Documents\WebUI Test Studio Projects\TestProject1\New Test(1).aii.cs:line 78
What is wrong?
Now I can run the test, but the step with Clear() method is failed with the following error:
InnerException:
System.NullReferenceException: Object reference not set to an instance of an object.
at TestProject1.New_Test_1_.New_Test1_CodedStep() in c:\Users\Documents\WebUI Test Studio Projects\TestProject1\New Test(1).aii.cs:line 78
What is wrong?
0
Hi Svetlana,
Did you get around this error? In general you need to find out what's returning null and fix it.
Have you double-checked the ID of the DatePicker wrapper element? Please note if the DatePicker has an ID as "PickerExpireDate" for example, it's Div element wrapper probably has "PickerExpireDate_wrapper" as ID. Just look around for the Div element with class like "RadPicker RadPicker_<skin_name>" and use its ID to find the RadDatePicker WebAii controls.
I hope this helps.
Greetings,
Konstantin Petkov
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.
Did you get around this error? In general you need to find out what's returning null and fix it.
Have you double-checked the ID of the DatePicker wrapper element? Please note if the DatePicker has an ID as "PickerExpireDate" for example, it's Div element wrapper probably has "PickerExpireDate_wrapper" as ID. Just look around for the Div element with class like "RadPicker RadPicker_<skin_name>" and use its ID to find the RadDatePicker WebAii controls.
I hope this helps.
Greetings,
Konstantin Petkov
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

Svetlana
Top achievements
Rank 1
answered on 08 Jun 2010, 08:48 AM
Hi Konstantin,
Now it works :)
I'm using the following code:
this.Find.ById<Telerik.WebAii.Controls.Html.RadDatePicker>("RadDatePicker1WrapperDiv").DateInput.Clear();
But can I use "Page.ASPNETCalendarDemoDate.RadWrapper"
instead of "this.Find.ById"?
And could you, please, tell how can I set some data to the control?
Thanks,
Svetlana
Now it works :)
I'm using the following code:
this.Find.ById<Telerik.WebAii.Controls.Html.RadDatePicker>("RadDatePicker1WrapperDiv").DateInput.Clear();
But can I use "Page.ASPNETCalendarDemoDate.RadWrapper"
instead of "this.Find.ById"?
And could you, please, tell how can I set some data to the control?
Thanks,
Svetlana
0
Hi Svetlana,
You should be able to use Page.ASPNETCalendarDemoDate.RadWrapper instead of finding the element manually, however you must be sure that it points to the correct element and is of the correct type.
As for setting a value in the picker, you can use its SetSelectedDate() method to assign a date to it.
Greetings,
Pavel
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.
You should be able to use Page.ASPNETCalendarDemoDate.RadWrapper instead of finding the element manually, however you must be sure that it points to the correct element and is of the correct type.
As for setting a value in the picker, you can use its SetSelectedDate() method to assign a date to it.
Greetings,
Pavel
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

Svetlana
Top achievements
Rank 1
answered on 08 Jun 2010, 03:47 PM
Thanks Pavel,
SetSelectedDate() method works :)
But I can't use element finding trough " Page.SomePage..." instead of finding the element manually.
The followng compilation error occurs:
: Line 0: (CS1061) 'ArtOfTest.WebAii.Controls.HtmlControls.HtmlDiv' does not contain a definition for 'SetSelectedDate' and no extension method 'SetSelectedDate' accepting a first argument of type 'ArtOfTest.WebAii.Controls.HtmlControls.HtmlDiv' could be found (are you missing a using directive or an assembly reference?)
The code:
[CodedStep(@"New Coded Step")]
public void New_Test1_CodedStep()
{
DateTime expDate = new DateTime(2018, 5, 1, 8, 30, 52);
Pages.Http19216801.PickerExpireDateWrapperDiv.SetSelectedDate(expDate);
}
Although I'm using the same DIV as when I search it during the test.
Regards,
Svetlana
SetSelectedDate() method works :)
But I can't use element finding trough " Page.SomePage..." instead of finding the element manually.
The followng compilation error occurs:
: Line 0: (CS1061) 'ArtOfTest.WebAii.Controls.HtmlControls.HtmlDiv' does not contain a definition for 'SetSelectedDate' and no extension method 'SetSelectedDate' accepting a first argument of type 'ArtOfTest.WebAii.Controls.HtmlControls.HtmlDiv' could be found (are you missing a using directive or an assembly reference?)
The code:
[CodedStep(@"New Coded Step")]
public void New_Test1_CodedStep()
{
DateTime expDate = new DateTime(2018, 5, 1, 8, 30, 52);
Pages.Http19216801.PickerExpireDateWrapperDiv.SetSelectedDate(expDate);
}
Although I'm using the same DIV as when I search it during the test.
Regards,
Svetlana
0
Accepted
Hi Svetlana,
It seems that the element's type is recognized as HtmlDiv instead of Telerik.WebAii.Controls.Html.RadDatePicker. That seems to happen if you manually add the element to the project elements in which case it is added as its base type (HtmlDiv in this case). We are currently investigating whether this is the expected behavior. If you first record a step which is handled by the translator, the element will be recognized as RadPicker. One option is to simply cast it to the correct type.
Another solution I can suggest you is to edit the xml of the .aii test file with a simple text editor and find the following tag in the element declaration:
and edit it like this:
Note that you will have to close and reopen the test project in this case, in order for the change to take effect.
Regards,
Pavel
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.
It seems that the element's type is recognized as HtmlDiv instead of Telerik.WebAii.Controls.Html.RadDatePicker. That seems to happen if you manually add the element to the project elements in which case it is added as its base type (HtmlDiv in this case). We are currently investigating whether this is the expected behavior. If you first record a step which is handled by the translator, the element will be recognized as RadPicker. One option is to simply cast it to the correct type.
Another solution I can suggest you is to edit the xml of the .aii test file with a simple text editor and find the following tag in the element declaration:
<
HtmlControlType
>ArtOfTest.WebAii.Controls.HtmlControls.HtmlDiv</
HtmlControlType
>
<
HtmlControlType
>Telerik.WebAii.Controls.Html.RadDatePicker</
HtmlControlType
>
Note that you will have to close and reopen the test project in this case, in order for the change to take effect.
Regards,
Pavel
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

Svetlana
Top achievements
Rank 1
answered on 09 Jun 2010, 10:05 AM
Hello Pavel,
You are right. I always add an elements manually through 'Add to project elements' button.
It works after I've added it by recorded step.
Thank you for the help! :)
You are right. I always add an elements manually through 'Add to project elements' button.
It works after I've added it by recorded step.
Thank you for the help! :)
0
Hello Svetlana,
We're glad that worked for you.
This is just to let you know we have added the necessary code so that using the "Add Project Element" option will add the element with the custom control type if any. The improvement will come out with the next internal build (it will be most probably uploaded in the beginning of the next week).
Regards,
Konstantin Petkov
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.
We're glad that worked for you.
This is just to let you know we have added the necessary code so that using the "Add Project Element" option will add the element with the custom control type if any. The improvement will come out with the next internal build (it will be most probably uploaded in the beginning of the next week).
Regards,
Konstantin Petkov
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

Svetlana
Top achievements
Rank 1
answered on 09 Jun 2010, 02:09 PM
Thank you, Konstantin!