Extract data and put it in excel file or local data

4 posts, 0 answers
  1. Victor
    Victor avatar
    11 posts
    Member since:
    Sep 2014

    Posted 03 Jun 2015 Link to this post

    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,

  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 08 Jun 2015 Link to this post

    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!
  3. Victor
    Victor avatar
    11 posts
    Member since:
    Sep 2014

    Posted 17 Jun 2015 in reply to Boyan Boev Link to this post

    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?

  4. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 22 Jun 2015 Link to this post

    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!
Back to Top