How can we executeScript from csv data?

Hi everyone,
I have written some javascript into my csv file. And I want to execute it. How can I do that?
This is my JSON
{
“Name”: “01”,
“CreationDate”: “2020-3-21”,
“Commands”: [
{
“Command”: “open”,
“Target”: “MDN Web Docs”,
“Value”: “”
},
{
“Command”: “csvRead”,
“Target”: “input.csv”,
“Value”: “”
},
{
“Command”: “executeScript”,
“Target”: “return ${!COL1};”,
“Value”: “getBackground”
},
{
“Command”: “echo”,
“Target”: “${getBackground}”,
“Value”: “”
},
{
“Command”: “executeScript”,
“Target”: “return jsGetBackgroundColor(‘#nav-footer’);”,
“Value”: “background”
},
{
“Command”: “echo”,
“Target”: “${background}”,
“Value”: “blue”
}
]
}

and This is my csv:
“var jsGetBackgroundColor = function(element){var rgbValue = window.getComputedStyle(document.querySelector(element)).backgroundColor;rgbValue = rgbValue.substr(4).replace(”“)”“, “””“);var arr = rgbValue.split(”“,”“);return “”#”" + ((1 << 24) + (parseInt( arr[0]) << 16) + (parseInt(arr[1]) << 8) +parseInt(arr[2])).toString(16).slice(1);};", test

What is this macro code?

Why you want to save in csv javascript ?

You can create a better code without using this strange mode.

1 Like

I want to create some common javascript functions (such to get background, get a style for some elements,…) to re-use them. If I don’t use csv file to store all common function, how can I do that?

Create it in macro and use it with run command

Csv have not this function.

You must use run command not csv

https://ui.vision/rpa/docs/selenium-ide/run

1 Like