Screenshot and will not and localStorageExport not supported

I am trying to get a captured screenshot when a test fails I keep getting the following errors in my logs. I have pasted the loges and the JSON code below. What am I doing wrong? I have tried I have tried Storage Mode and File System Mode.

  • [info]

Executing: | captureScreenshot | run_${tableCounter}_${!URL}_failed | |

  • [error][ignored]

A requested file or directory could not be found at the time an operation was processed.

  • [info]

Executing: | LocalStorageExport | run_${tableCounter}_${!URL}_failed.png | |

  • [error][ignored]

Command LocalStorageExport not supported yet

{
“Command”: “waitForVisible”,
“Target”: “//input[@tabindex=‘183’]”,
“Value”: “”
},
{
“Command”: “if”,
“Target”: “!${!LastCommandOK}”,
“Value”: “”
},
{
“Command”: “captureScreenshot”,
“Target”: “run_${tableCounter}${!URL}failed",
“Value”: “”
},
{
“Command”: “LocalStorageExport”,
“Target”: "run
${tableCounter}
${!URL}failed.png",
“Value”: “”
},
{
“Command”: “echo”,
“Target”: “Failed URL ${!URL}”,
“Value”: “red”
},
{
“Command”: “store”,
“Target”: "run
${tableCounter}url${!URL}page${pageNumber}”,
“Value”: “!csvLine”
},
{
“Command”: “csvSave”,
“Target”: “failedURL.csv”,
“Value”: “!csvLine”
},
{
“Command”: “gotoLabel”,
“Target”: “startTest”,
“Value”: “”
},
{
“Command”: “endif”,
“Target”: “”,
“Value”: “”
},

The error message is confusing, but the reason is that because of ${!URL} the image name contains illegal characters such as //.

What about the other issue “Command LocalStorageExport not supported yet”? Is there any way to use the url as a name and remove the special chars? or can I pull part of the text from the URL?

You can use Javascript to remove illegal characters from a file name:

{
  "Name": "url",
  "CreationDate": "2018-12-16",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://forum.a9t9.com",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "str = \"${!URL}\"; str= str.replace(/([^a-z0-9]+)/gi, '_'); str",
      "Value": "cleanurl"
    },
    {
      "Command": "captureScreenshot",
      "Target": "run_${cleanurl}",
      "Value": ""
    }
  ]
}
1 Like

With today’s update, the javascript workaround is no longer needed. For file names, Kantu replaces illegal characters with “_” automatically now :slight_smile:

I still can not get export to work with out having to manually do it? I get this error msg:

  • [error][ignored] Command LocalStorageExport not supported yet

Is there a export for screen shots yet?

@blueice349 what kantu version do you have?

If it is the latest, can you please paste a test macro here?

Kantu Version 3.6.6

Macro:
{
“Command”: “if”,
“Target”: “!${!LastCommandOK}”,
“Value”: “”
},
{
“Command”: “storeEval”,
“Target”: “str = "${!URL}"; str= str.replace(/([^a-z0-9]+)/gi, ''); str",
“Value”: “cleanurl”
},
{
“Command”: “captureScreenshot”,
“Target”: "page
${pageNumber}row${tableCounter}${cleanurl}",
“Value”: “”
},
{
“Command”: “LocalStorageExport”,
“Target”: "page
${pageNumber}row${tableCounter}_${cleanurl}.png”,
“Value”: “#DeleteAfterExport
},
{
“Command”: “echo”,
“Target”: “URL ${!URL} Failed The Test!”,
“Value”: “red”
},

Logs:

  • [info]

Executing: | captureScreenshot | page_${pageNumber}row${tableCounter}_${cleanurl} | |

  • [info]

a new screenshot captured

  • [info]

Executing: | LocalStorageExport | page_${pageNumber}row${tableCounter}_${cleanurl}.png | |

  • [error][ignored]

Command LocalStorageExport not supported yet

  • [info]

Executing: | echo | URL ${!URL} Failed The Test! | red |

  • [echo]

URL https://western.omadi.com/node/306070/edit?destination=account/list Failed The Test!