When writing a full-fledged JavaScript, how can I split all my classes into different UI.Vision executeScript commands so it’s somehow readable? The current JS code I’ve written is almost a thousand of lines and is working when put in ONE executeScript command but I want to split them so that it’s
“easier” to maintain.
e.g.
{
"Command": "executeScript_Sandbox",
"Target": "return class ClassWithStaticMethod { static staticMethod() { return 'static method has been called.'; } } ",
"Value": "ClassWithStaticMethod"
},
{
"Command": "executeScript_Sandbox",
"Target": "var s = \"Hello World! \" + ClassWithStaticMethod.staticMethod(); return s",
"Value": "testReturn"
}
What I’m trying to say is, how would I call the JavaScript static methods / functions coming from the previous line?
[error] Error in executeScript code: Cannot read property ‘staticMethod’ of undefined
Is the only way this would work is if the whole JavaScript code is in one executeScript[_Sandbox] command?