Get text and cmd in TestProject.io

By | August 22, 2021

TestProject is a really neat app to perform automated testing. It takes a bit of getting use to but is generally really easy to use. I had a situation where I was manually logging in every hour to get solar data in order to plot my cumulative generation. I get instantaneous output overtime from the app but not cumulative.

The data at times was patchy because I had to remember to log in every hour. It was such hard work. Enter TestProject.io

With TestProject.io, I recorded myself logging in, then adding a “pause” action for 3 seconds to give time for the site to log in.

Next was the tricky part. I had to copy the value from a particular location and paste it into notepad. This didn’t work for me but I found another way. The “Get text” action was the secret where it would get the value I wanted at a particular XPATH.

I then placed the value I “got” into a variable called data. What is neat is that you can hover over the variable to see the actual value.

The last step is probably the trickiest. I used an action called “Executes” which “Executes a command using operating system shell”.

The command I used was

echo {data} >> solar.csv

I then specified the output file path and the output file name as well. I got a little fancy below and added a timestamp as well via the action “Get the current DataTime” just as an experiment. In reality I need to remove this if I wanted to import this into excel as a pure csv.

The result?

Note that I had to create a job and then a scheduler for every hour.

So that is it. Problem solved. I can then import this into excel and not have to miss a beat.

Improvements

  • Create a header row
  • Append all results within a day on a single line with a comma
  • Strip out the units
  • Install agent on hosting provider instead of my laptop

Leave a Reply

Your email address will not be published. Required fields are marked *