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

Generic Find.ByAutomationId<T> method returns null whilst non-generic Find.ByAutomationId returns value

2 Answers 20 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Artem
Top achievements
Rank 1
Artem asked on 19 Aug 2014, 07:18 AM
Hi,

I'm a little confused here: I was trying to use generic Find.ByAutomationId<T> method that is supposed to return me actually FrameworkElement object for now (the same as non-generic method returns), but it returns me null. Though when I use non-generic sibling (Find.ByAutomationId) it seems to be working fine. Any ideas why it might happen? Cast problems? I was wondering if the method actually returns anything if it can't cast, but well, non-generic works. The element is definitely present in the xaml structure and has correct automation id (as proved by non-generic method once again).

Thank you,
Artem

2 Answers, 1 is accepted

Sort by
0
Artem
Top achievements
Rank 1
answered on 22 Aug 2014, 12:45 AM
So, none has any ideas? the controls it looks for inherit IFrameworkElement. Non-generic works fine, but it's not suitable...
0
Konstantin Petkov
Telerik team
answered on 22 Aug 2014, 06:54 AM
Hello Artem,

The cast could be the problem. The framework finds an element with the specified attribute, however if the cast fails it will stop the search and return null.

Regards,
Konstantin Petkov
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Artem
Top achievements
Rank 1
Answers by
Artem
Top achievements
Rank 1
Konstantin Petkov
Telerik team
Share this question
or