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

Use a variable in element find logic

5 Answers 440 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bryan
Top achievements
Rank 1
Bryan asked on 01 Feb 2016, 09:40 PM

I need to use the value from a variable to find an element to click.

The variable value is being extracted from a database using C# (data binding won't work because I am already bound to the data, but this value did not exist at the time of binding).

The variable name is varDocID

I am trying to use it to compare to the OnClick event of the image I need to click in a grid with many instances of the same image.

~$(varDocID) does not work as it does not use the value and only tries to comapre to the variable name instead of the variable value.

Please advise.

5 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 04 Feb 2016, 12:17 PM
Hi Bryan,

Here is a detailed article about data driven find expression.

If you create the variable in code you should then type its name manually in the drop down.

Let me know if that works for you.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Joshua
Top achievements
Rank 1
answered on 13 Jan 2021, 06:49 AM

Hi,

Sorry to resurrect this thread but I can't seem to find an answer anywhere else. I have a test that needs to do the same thing, and it does not have a data source binding, but I wish to use a variable (ExtractedValue) I have set in a coded step in the test.

In the linked article, it reads "To be able to data drive an element, you need to add a data source and bind it to the test, which uses the element."

But I don't have a data source, there is only the variable. I can't seem to get to the "coded data variable dropdown field" in the element find expression. Do I need add a dummy data source file that I won't use to enable the functionality, or is there an option I am missing?

0
Elena
Telerik team
answered on 13 Jan 2021, 04:24 PM

Hi Joshua,

I am sorry to hear you have encountered this misbehavior and will be glad to help you sort it out. 

Actually, this is a known, for us in Test Studio, issue with the extracted variables in code and data driven elements' find expression - there is also a public item on the topic listed in our feedback portal. Although, the item dates back quite many years ago, the behavior is still the same. 

The workaround to overcome this limitation is to set a dummy data source to enable the data driven logic for the test and allow the elements' find logic to be data driven. The easiest way to do this will be to add a local data source in the test. You need to enter data in a single cell of the data table and save the test. Then you will see the dropdown in the element's Edit mode

Please, note that the extracted variables are not listed in this dropdown and you need to manually type the name in the input field, click on the curly brackets and then the Set button. 

I hope that this will help you adjust the test you work on. Do not hesitate to get back to me in case of any further questions on the case. 

Thank you for your understanding and cooperation in advance.

Regards,
Elena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
0
Joshua
Top achievements
Rank 1
answered on 14 Jan 2021, 07:12 PM

Hi Elena,

Thanks for your reply and elaboration. I'll go ahead and add a local dummy data source as prescribed to enable the data-driven find expression functionality.

0
Elena
Telerik team
answered on 15 Jan 2021, 12:59 PM

Hello Joshua, 

Thanks for your understanding once again. Do not hesitate to get back to me in case you face any further difficulties with the data driven find expression scenario. 

Regards,
Elena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
Tags
General Discussions
Asked by
Bryan
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Joshua
Top achievements
Rank 1
Elena
Telerik team
Share this question
or