I have the latest MacOS and Safari on a 2012 Macbook Pro.
https://stackoverflow.com/questions/50513038/how-to-automate-download-of-generated-pdfs/50515826#50515826 provides me with a function and a loop to call multiple times.
If I paste the function definition into the JS console, then the loop command, nothing happens.
If I change the function call to "console.log" and put that in, it prints the correct parameters.
If I redefine the function to call console.log and type in the call again, that works. If I then paste the original loop, nothing happens.
Conclusion: Safari JS console doesn't allow injected JS to call a user-defined function.
Is that a bug, or is there a security setting that I need to change?