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

Can regular expressions or something similar be used in Finds?

1 Answer 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dren
Top achievements
Rank 1
Dren asked on 08 Oct 2012, 06:52 AM
Hi,

The Silverlight application I am testing has a popup with the text inside it "Cannot delete ABC." where ABC is the name of the object.

Doing this works and it finds the popup:
var foundPopup = popup.VisualTree.Find.ByExpression(new XamlFindExpression("TextContent=Cannot delete ABC"));


But...
The object isn't always going to be called ABC. I'd like to parameterise it. I was hoping a regular expression or something like that could be used to do this.

What is the best way to have a wildcard substitute for ABC?

Thanks,
Dren

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 11 Oct 2012, 11:56 AM
Hello Dren,

If only the 'ABC' is changing, it's easiest to use the tilde (~) to indicate a partial match based on the static portion of the string:
var foundPopup = popup.VisualTree.Find.ByExpression(new XamlFindExpression("TextContent=~Cannot delete"));


All the best,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Dren
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or