Having trouble executing JS function with InjectJS

Hello,

I’m building a really simple test case and want to trigger the Javascript function “calculate()” from a simple online calculator (JavaScript Calculator Online). I can do it through the Chrome console and through the buttons but I need to be able to call the function directly.

The most common error I’m getting is “Inject Js Script: ReferenceError: calculate is not defined”.

In my JS file I’ve tested with both:

  • “calculate()”

  • " function trigger(element, input) {
    calculate();
    return “result”;
    }"

Is it even possible to call predefined functions from websites?

Many thanks