Let's say I have a JS function like that:
function someFunction(callback) {
callback()
}
and I want to call it from Selenium. for normal arguments (e.g. strings, arrays, integers, maps, HTML Elements) I can do:
driver.executeScript("someFunction(arguments[0])", "() => console.log('hi')")
and Selenium automatically converts/escapes the arguments. but if an argument is a function, then it's passed as a string. the call above becomes:
someFunction("() => console.log('hi')")
but it should have been:
someFunction(() => console.log('hi'))
is there a way to tell Selenium that the passed argument is a function?