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

FindByExpression fails

1 Answer 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 14 Oct 2015, 11:56 AM

Hey Guys,

After being very happy with your Framework for my studies, I decided to show it to my fellow workers and my boss at work. They gave me two days to generate some of the tests we need for our project, in order to decide if to purchase the TS solution or stay with Microsoft's standard Framework.

 So far, I am making good progress, but there is one problem I am not able to solve.

In General

I have got a grid view with some comboboxes inside. The comboboxes are not explicitly created by Xaml code, but instead are generated automatically by some Framework behind by providing the Framework with a table and the names of the ID and display columns.

The Good side

TS does not give a WindowsME about that... It finds the Element, and can select items.

The Problem
TS displays the following expression in the rep:

XamlTag=datagridcontrol,name=dgrMelder,|,XamlPath=/grid[0]/border[0]/adornerdecorator[name=PART_DragDropAdornerDecorator]/tableviewscrollviewer[name=PART_ScrollViewer]/grid[0]/grid[0]/synchronizedscrollviewer[name=fixedFooterScrollViewer]/grid[0]/scrollcontentpresenter[0]/tableviewheaderfooterpanel[0]/headerfooteritem[0]/gridtoolbarinsertionrowsteuermatrix[0]/border[0]/contentpresenter[0]/stackpanel[0]/insertionrow[0]/grid[name=rootGrid]/fixedcellpanel[name=PART_CellsHost]/scrollingcellsdecorator[0]/virtualizingfixedcellsubpanel[0]/insertioncell[1]/grid[0]/border[name=rootBorder]/grid[0]/cellcontentpresenter[name=PART_CellContentPresenter]/grid[0]/innercellcontentpresenter[1]/comboboxex[0]

When I try to find the Element via FindByExpression it fails.

I tried:

FrameworkElement cmbb = WpfApplication.MainWindow.Find.ByExpression(new XamlFindExpression("XamlTag=datagridcontrol,name=dgrMelder,|,XamlPath=/grid[0]/border[0]/adornerdecorator[name=PART_DragDropAdornerDecorator]/tableviewscrollviewer[name=PART_ScrollViewer]/grid[0]/grid[0]/synchronizedscrollviewer[name=fixedFooterScrollViewer]/grid[0]/scrollcontentpresenter[0]/tableviewheaderfooterpanel[0]/headerfooteritem[0]/gridtoolbarinsertionrowsteuermatrix[0]/border[0]/contentpresenter[0]/stackpanel[0]/insertionrow[0]/grid[name=rootGrid]/fixedcellpanel[name=PART_CellsHost]/scrollingcellsdecorator[0]/virtualizingfixedcellsubpanel[0]/insertioncell[1]/grid[0]/border[name=rootBorder]/grid[0]/cellcontentpresenter[name=PART_CellContentPresenter]/grid[0]/innercellcontentpresenter[1]/comboboxex[0]")).As<ComboBox>();

 AND

FrameworkElement dgrMelder = WpfApplication.MainWindow.Find.ByName<DataGrid>("dgrMelder");
FrameworkElement cmbb = WpfApplication.MainWindow.Find.ByExpression(dgrMelder, new XamlFindExpression("xamlpath=/grid[0]/border[0]/adornerdecorator[name=PART_DragDropAdornerDecorator]/tableviewscrollviewer[name=PART_ScrollViewer]/grid[0]/grid[0]/synchronizedscrollviewer[name=fixedFooterScrollViewer]/grid[0]/scrollcontentpresenter[0]/tableviewheaderfooterpanel[0]/headerfooteritem[0]/gridtoolbarinsertionrowsteuermatrix[0]/border[0]/contentpresenter[0]/stackpanel[0]/insertionrow[0]/grid[name=rootGrid]/fixedcellpanel[name=PART_CellsHost]/scrollingcellsdecorator[0]/virtualizingfixedcellsubpanel[0]/insertioncell[1]/grid[0]/border[name=rootBorder]/grid[0]/cellcontentpresenter[name=PART_CellContentPresenter]/grid[0]/innercellcontentpresenter[1]/comboboxex[0]"));

 

I also tried to use verbatim stringsm just for the case. But it didn't change anything.

Can you help me?

Stephan

1 Answer, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 19 Oct 2015, 07:44 AM
Hello Stephan,

Thank you for contacting us.

It seems that the structure of the grid is generated dynamically and it changes every time hence you cannot find it. This is expected behavior.

Could you please send us a screen shot of the DOM tree and another one after refreshing the site.

So we can help you with the find expression.

Thank you!

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Stephan
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Share this question
or