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.
Executing: | captureScreenshot | run_${tableCounter}_${!URL}_failed | |
A requested file or directory could not be found at the time an operation was processed.
Executing: | LocalStorageExport | run_${tableCounter}_${!URL}_failed.png | |
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”: “”
},
ulrich
December 16, 2018, 9:42am
2
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?
Timo
December 16, 2018, 9:11pm
4
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
admin
December 20, 2018, 8:42pm
5
With today’s update , the javascript workaround is no longer needed. For file names, Kantu replaces illegal characters with “_” automatically now
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?
admin
December 27, 2018, 9:00pm
7
@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:
Executing: | captureScreenshot | page_${pageNumber}row ${tableCounter}_${cleanurl} | |
a new screenshot captured
Executing: | LocalStorageExport | page_${pageNumber}row ${tableCounter}_${cleanurl}.png | |
Command LocalStorageExport not supported yet
Executing: | echo | URL ${!URL} Failed The Test! | red |
URL https://western.omadi.com/node/306070/edit?destination=account/list Failed The Test!