I am using Telerik RadDatePicker control (v. 2009.2.0812.1030) for selecting dates. When I try to run UI Spy to expose automation IDs, I get a generic name as AutomationID such as "InputBox" for RadDatePicker eventhough it has a unique name attributes like x:Uid="idDatesRTO" x:Name="date_Dates_RTO"
Could you please let me know how do I uniquely identify ID of RadDatePicker so that I can run auomtation through UI Spy ?
Any help would really be appriciated as this has become a blocker for me.
Thanks,
Bhavik
6 Answers, 1 is accepted
As you can see here UI Automation is not supported for RadDatePicker. Nevertheless you get "InputBox" because this is the name of the PickerTextBox, witch is part of RadDatePicker template. So what you need to do is edit the template of the DatePicker, for example like this:
<
telerik1:PickerTextBox
x:Name
=
"InputBox"
AutomationProperties.AutomationId
=
"MyTestId"
Grid.Column
=
"0"
HorizontalContentAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
IsTabStop
=
"{TemplateBinding IsEnabled}"
IsReadOnly
=
"{TemplateBinding IsReadOnly}"
Padding
=
"{TemplateBinding Padding}"
telerik1:StyleManager.Theme
=
"{StaticResource Theme}"
VerticalContentAlignment
=
"{TemplateBinding VerticalContentAlignment}"
/>
So setting
AutomationProperties.AutomationId
=
"MyTestId"
to desired unique ID should work.I have attached a simple project where you can see how to implement all this.
Greetings,
Georgi
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
However, after implementing the template, when I click on the Button named "ToogleButtonElement", it does not display the calendar.
Similar behavior also happends when I run your sample project. Clicking on the raddatepicker button does nothing.
Could you please tell me what am I missing here ?
Thanks,
Bhavik
I am not sure why this is happening. As you can see in the attached video DatePicker works fine and the Calendar is opening as expected. It will be great if you can send us a video. If we are doing the same thing it could mean that this is environmental issue. Can you, please tell me what Silverlight, Silverlight plugin and Operation system you are using?
Kind regards,
Georgi
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
We are having a similar problem with the RADDatePicker, but my version is the latest on Version 2012 Q1, File version 2012.215.1040. I tried modifying the Template, but since there is ContentPresenter in the RadWatermarkTextBox I just could not pass on my AutomationID.
Our scenario is that we are using 2 RadDatePicker in a UserControl which calculates a duration period. The initializaion is always with the present time for the start and the end time is 10 minutes after. The problem is when we record a testcase, the TextBlock which is rendered has the value with the initalization time as show below:
/dom[@domain=localhost:8088']/body/form/div[@id='silverlightControlHost']/object/form/progressbar/container/container/table/container/row/form[4]/text[@automationid='PART_DateTimeInput' and @name='16.05.2012 10:01']/container[@automationid='ContentElement']
So when we play the testcase, it is not recognised as the time differs.
Could you please help me out here? This is a key control in our system since it is booking software and the booking duration is calculated by this control.
Regards
Liz from ORF team
I might have solution of this issue. In the attached project I am editing the template of the RadDatePicker and setting AutomationProperies.Name like this:
<telerik:RadWatermarkTextBox x:Name="PART_DateTimeInput" AutomationProperties.Name="myWatermark" BorderBrush="{x:Null}" .......
Also I have created a coded UI test with Name and Text assertions.
Can you, please check it out and tell me if this works for you?
All the best,
Georgi
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
That did the trick!! It works now! I should have tried with the RadWatermarkTextBox instead of digging deeper. Thanks alot! That was a big help!
Greetings
Liz
the ORF team