csvSave only saves headers

N.B. Trying to work out a tutorial made on Ui.vision 5.3.17 while I use version 5.8.8

My problem:

csvSave doesn’t work as expected to write out the values stored in the downloadSpeed and uploadSpeed variables. Instead writes this in the CSV file, starting with line 2(?):

1
2 Download Speed,$(downloadSpeed),Upload Speed,$(uploadSpeed)
3

While the variables are properly stored as:

Name Value
DOWNLOADSPEED “47.90”
UPLOADSPEED “16.84”

Any idea why that may be and how to mend it?


Here’s how my JSON file looks:

{
  "Name": "SpeedTest Macro",
  "CreationDate": "2020-8-28",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://www.speedtest.net/",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "15",
      "Value": "!TIMEOUT_WAIT"
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@id=\"container\"]/div/div[3]/div/div/div/div[2]/div[3]/div/a/span[4]",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "60",
      "Value": "!TIMEOUT_WAIT"
    },
    {
      "Command": "waitForElementVisible",
      "Target": "linkText=Change Server",
      "Value": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"container\"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div/div[2]/div/div[2]/span",
      "Value": "downloadSpeed"
    },
    {
      "Command": "storeText",
      "Target": "xpath=//*[@id=\"container\"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div/div[3]/div/div[2]/span",
      "Value": "uploadSpeed"
    },
    {
      "Command": "store",
      "Target": "Download Speed",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "$(downloadSpeed)",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "Upload Speed",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "$(uploadSpeed)",
      "Value": "!csvLine"
    },
    {
      "Command": "csvSave",
      "Target": "DataTransferSpeedHistory-2",
      "Value": ""
    }
  ]
}

here’s a gist for the same


Edit: Forgot the browsers and architecture I’ve tested this on:

Linux: Ubuntu 16.04 LTS
Chrome: Version 84.0.4147.135 (Official Build) unknown (64-bit)
Firefox: 80.0 (64-bit) N.B. the website(?) may not like Firefox, or Ui.vision as I couldn’t make it work :frowning: … even when I did allow Facebook decontainerization :frowning_face:

I fixed your macro with 2 best xpaths and fixed error in variables

Here new code

{
  "Name": "CCCC",
  "CreationDate": "2020-8-29",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://www.speedtest.net/",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "15",
      "Value": "!TIMEOUT_WAIT"
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@id=\"container\"]/div/div[3]/div/div/div/div[2]/div[3]/div/a/span[4]",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "60",
      "Value": "!TIMEOUT_WAIT"
    },
    {
      "Command": "waitForElementVisible",
      "Target": "linkText=Change Server",
      "Value": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=//span[@data-download-status-value='0.01']",
      "Value": "downloadSpeed"
    },
    {
      "Command": "storeText",
      "Target": "xpath=//span[@data-upload-status-value='0.00']",
      "Value": "uploadSpeed"
    },
    {
      "Command": "store",
      "Target": "Download Speed",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "${downloadSpeed}",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "Upload Speed",
      "Value": "!csvLine"
    },
    {
      "Command": "store",
      "Target": "${uploadSpeed}",
      "Value": "!csvLine"
    },
    {
      "Command": "csvSave",
      "Target": "DataTransferSpeedHistory-2",
      "Value": ""
    }
  ]
}

Resul csv

Download Speed,14.01,Upload Speed,0.67

Thanks a million.

The error was in my ears + English as a Second Language.

I didn’t look up curly brackets {} and used rounded brackets () instead :man_facepalming:

Mark this post like solved click on solution button please