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

Extract data and put it in excel file or local data

4 Answers 209 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rainton
Top achievements
Rank 1
Rainton asked on 03 Jun 2015, 03:18 PM

Hi guys, 
I was wondering if and or how I can extract data from a cell on the website and paste/save the data into the local data for the same test or into an excel file. 
I am randomly creating a few account and after creating them it gives a message that account has been successfully created for "NewAccountName".
I would like to extract the Newaccountname and put it into an excel file or into the local data so I could reuse it afterwards.

I am not sure if it is possible to do this, 

 

Thanks in advance,

4 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 08 Jun 2015, 11:44 AM
Hello Victor,

Yes you can achieve this.

Please extract the cell while recording. After that you should use a coded step to write the value of the extracted variable into the Excel file.

Here is how to get the value of the variable via code.

You can check this example on how to write into Excel file in code.

Hope this helps.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Harry
Top achievements
Rank 1
commented on 07 Feb 2024, 11:41 AM | edited

Hi, I have encountered the same situation, however, would like to ask is there any way to do the extraction without using coded step? I am able to extract the string, the message now is "Extract value of DocumentRichEditControl 'Exact' Box # 220000..." at the recording steps. However, just wanted to do it in a low code environment.

Meanwhile, may I also know where can I view the documentricheditcontrol table? 

 

Thanks !

0
Rainton
Top achievements
Rank 1
answered on 17 Jun 2015, 08:28 PM

Hi Boyan,
sorry for the late reply.
I encountered a few issues but figured that part out.
I think the page how to get/set variable is a bit vague.
I had the recorder extract that the text contains "string" and I wanted to use that string to be displayed in a messagebox.

object myData = GetExtractedValue("varname");

Object can be replaced with string or integer?  "varname" is where you have to enter the Databindvariablename?
if you cannot change the object to string or integer will you have to convert it to string? .Tostring?

0
Boyan Boev
Telerik team
answered on 22 Jun 2015, 03:02 PM
Hi Victor,

A object can be convert to string via the ToString() method.

Also please note that you can use the extracted variable during recording in a typing step via the properties of the step.

See this article.

Hope this helps.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Shtilianov
Telerik team
answered on 08 Feb 2024, 12:58 PM

Hi,

It is possible to save data during test execution in the memory. For example, on the question by Rainton, you have two options. One is to use an extract step as mentioned here - Extract step docs. The extract steps will get the content of an element and save it in a variable that can be accessed in other steps or even in the steps of a test as step.

The other option is to get the content you need and set it as data variable in code: How to set data variables in code. This allows for more flexibility where you can also modify the data before saving it in a data variable. 

Another possibility is a combination of the two options, you can extract the element contents using extract step. Create a coded step and access it using the "Get extracted variables in code" option, then save the data in a csv file or some other format. Once you have it in an external file, you can reuse it between tests, even between different projects.

Regards, Miroslav Shtilianov Progress Telerik

Virtual Classroom is the free self-paced technical training portal that gets you up to speed with Telerik and Kendo UI products including Telerik Test Studio! Check it out at https://learn.telerik.com/.
Tags
General Discussions
Asked by
Rainton
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Rainton
Top achievements
Rank 1
Shtilianov
Telerik team
Share this question
or