Write value (innertext) to csv

Ranorex Spy, Recorder, and Studio.
jojomonsta
Posts: 12
Joined: Wed May 27, 2015 9:53 am

Write value (innertext) to csv

Post by jojomonsta » Mon Dec 12, 2016 5:49 pm

Hi
Hope you can help me...

I am a tester dabbling in C#, but when I get stuck I do enlist the help of a developer, and I have been scouring the forum for information on this but don't see a clear picture about whether this can be done and if so, how.

Anyway, I know that I can use the 'Get' and 'Set' actions to grab and use a variable, which I can use and set as a Global Parameter, however I would assume that this would be over-written in each iteration.
What I would like to do is use the captured value in subsequent tests, but these may or may not be run alongside the tests in which the value I wish to capture is found, if this makes sense?

I hope you're still with me so far!? :lol:

So, my ideal scenario would be to capture the inner text value from the UI (an application Id, a unique Id generated for each of my iterations) and append to a csv or text file. I can then use this as a data sheet for the subsequent tests.

Is this something which can be done?
Any advice/help appreciated. Thank you.

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Write value (innertext) to csv

Post by Vaughan.Douglas » Mon Dec 12, 2016 7:31 pm

There are a lot of ways you could go about accomplishing this. Depending on your CSV you may be able to access it using the Microsoft ACE data provider. This is much easier if you're using an Excel file rather than a CSV. Not all CSV are created equally, an example where it doesn't work for some reason.

Microsoft also has a text connector you can try. I don't have any experience with this one though.

One thing to keep in mind, you can't update the bound data because the data source is apparently read at the start of the test set. The changes will write out, but they won't be read into the subsequent tests. This will also give you a headache when you start running tests remotely because the file you'll be trying to update is in a zip (unless you keep in in another location).

A better solution would be to create a database and update your values there.
Doug Vaughan

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Write value (innertext) to csv

Post by odklizec » Mon Dec 12, 2016 7:40 pm

Hi,

You can use also built-in Ranorex CSV data connector, which supports writing to CSV file. Check for example this post...
http://www.ranorex.com/forum/writing-in ... tml#p34657
Last edited by odklizec on Tue Dec 13, 2016 12:50 pm, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

jojomonsta
Posts: 12
Joined: Wed May 27, 2015 9:53 am

Re: Write value (innertext) to csv

Post by jojomonsta » Tue Dec 13, 2016 11:15 am

Vaughan.Douglas wrote: One thing to keep in mind, you can't update the bound data because the data source is apparently read at the start of the test set. The changes will write out, but they won't be read into the subsequent tests. This will also give you a headache when you start running tests remotely because the file you'll be trying to update is in a zip (unless you keep in in another location).
I did not think of this and it's a valid point. The DB option may be a better one. I can scrape AppIds from the system DB but I cannot guarantee that they will be in the same state each time I run the tests, hence wanting to use freshly created examples.

odklizec - thankyou for your suggestion. I did look at this but I would need to get the developer to translate for me!

Thanks for your advice though, both of you. This may be a 'back to the drawing board' scenario :D