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

Dynamic variable with WPF recorder

2 Answers 59 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 17 Jan 2013, 07:25 AM
Hi all,

I've recorded a test case and when i clicked in a button, here is the telerik code generated:
Applications.MyAppexe.Bob_McLean_1162013.SuperbillTextblock.User.Click(xx.xxx.xxx)
SuperbillTextblock is the name of my button
I wonder why the WPF Telerik recorder has recorded the date of the day "1162013" (16th January 2013). It doesn't make any sense.
Therefore, when I try to play back my script another day, it doesn't work.
How can we make a dynamic variable with the date of the current day?

Something like:
Date currentDate = new Date(xxxx);
Applications.MyAppexe.Bob_McLean_{currentDate}.SuperbillTextblock.User.Click(xx.xxx.xxx)


I don't know the exact syntax but I'm sure it's possible to do it.
Don't hesitate to tell me if you have a better idea to solve my issue.

Thanks in advance for your help.

2 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 22 Jan 2013, 10:55 AM
Hello Mark,

It seems that you are dealing with a dynamic WPF window title and the title name is based on the current date. In order to make this to work every time you run the test, you need to change the Caption property for the WPF Window. Use tilde (~) to indicate a partial match. See here for more information.

For example, if the value of the Caption property is:
Bob_McLean_1162013
 

You can change it to:
~Bob_McLean_
 
Please give it a try and let me know if it works.

All the best,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Mark
Top achievements
Rank 1
answered on 24 Jan 2013, 04:15 AM
Thanks a lot Plamen. Now it works.
Tags
General Discussions
Asked by
Mark
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Mark
Top achievements
Rank 1
Share this question
or